repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
leafiy/miniblog
website/vue.config.js
const path = require('path') const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const HTMLWebpackPlugin = require('html-webpack-plugin') const webpack = require('webpack') module.exports = { devServer: { open: false, port: 8040, https: false, hotOnly: false, bonjour: true, allowedHosts: ['qiansmile.local'], proxy: null, // string | Object before: app => { // app is an express instance } }, productionSourceMap: false, configureWebpack: config => { return { entry: { 'mavon-editor': ['mavon-editor'] } } } }
voxel-web/samson
test/controllers/versions_controller_test.rb
<gh_stars>1-10 # frozen_string_literal: true require_relative '../test_helper' SingleCov.covered! describe VersionsController do def create_version(user) PaperTrail.with_whodunnit_user(user) do PaperTrail.with_logging do stage.update_attribute(:name, 'Fooo') end end end let(:stage) { stages(:test_staging) } as_a_viewer do describe "#index" do before { create_version user } it "renders" do get :index, params: {item_id: stage.id, item_type: stage.class.name} assert_template :index end it "renders with jenkins job name" do stage.update_attribute(:jenkins_job_names, 'jenkins-job-1') stage.update_attribute(:jenkins_job_names, 'jenkins-job-2') get :index, params: {item_id: stage.id, item_type: stage.class.name} assert_template :index assert_select 'p', text: /jenkins-job-1/ end it "renders with unfound user" do create_version(User.new { |u| u.id = 1211212 }) get :index, params: {item_id: stage.id, item_type: stage.class.name} assert_template :index end it "renders with deleted item" do stage.delete get :index, params: {item_id: stage.id, item_type: stage.class.name} assert_template :index end it "renders with removed class" do stage.versions.last.update_column(:item_type, 'Whooops') get :index, params: {item_id: stage.id, item_type: 'Whooops'} assert_template :index end end end end
Amin-MAG/CodART
benchmark_projects/ganttproject/ganttproject/src/main/java/net/sourceforge/ganttproject/action/task/IndentTargetFunctionFactory.java
/* Copyright 2012 GanttProject Team This file is part of GanttProject, an opensource project management tool. GanttProject is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GanttProject is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GanttProject. If not, see <http://www.gnu.org/licenses/>. */ package net.sourceforge.ganttproject.action.task; import java.util.Collection; import net.sourceforge.ganttproject.task.Task; import net.sourceforge.ganttproject.task.TaskContainmentHierarchyFacade; import net.sourceforge.ganttproject.task.TaskManager; import com.google.common.base.Function; /** * Creates functions resolving move target for indent operations. Function depends on the set of tasks being moved so * it is different every time * * @author dbarashev */ class IndentTargetFunctionFactory implements Function<Collection<Task>, Function<Task, Task>> { private final TaskManager myTaskManager; IndentTargetFunctionFactory(TaskManager taskManager) { myTaskManager = taskManager; } @Override public Function<Task, Task> apply(final Collection<Task> indentRoots) { return new Function<Task, Task>() { private final TaskContainmentHierarchyFacade myTaskHierarchy = myTaskManager.getTaskHierarchy(); @Override public Task apply(Task whatMove) { Task moveTarget = whatMove; for (; moveTarget != null && indentRoots.contains(moveTarget); moveTarget = myTaskHierarchy.getPreviousSibling(moveTarget)); return moveTarget; } }; } };
Kamahl19/dokina
src/index.js
<gh_stars>0 import { AppRegistry, Platform } from 'react-native'; import KeyboardManager from 'react-native-keyboard-manager'; import Root from './app/containers/Root'; AppRegistry.registerComponent('dokina', () => Root); if (Platform.OS === 'ios') { KeyboardManager.setEnable(true); KeyboardManager.setEnableAutoToolbar(false); }
bryan-brancotte/rank-aggregation-with-ties
sources/rnt/mediane/algorithms/lri/ExactAlgorithm_preprocessing.py
from mediane.algorithms.lri.CondorcetPartitiong import CondorcetPartitioning from mediane.algorithms.lri.ExactAlgorithm_bis import ExactAlgorithmBis class ExactAlgorithmPreprocessing(CondorcetPartitioning): def __init__(self): super().__init__(ExactAlgorithmBis()) def get_full_name(self): return "ExactAlgorithm_preprocessing" def can_be_executed(self) -> bool: return ExactAlgorithmBis().can_be_executed() and CondorcetPartitioning().can_be_executed()
coolgeeck/delwar1
azure_functions_devops_build/service_endpoint/github_service_endpoint_manager.py
import vsts.service_endpoint.v4_1.models as models from vsts.exceptions import VstsServiceError from ..base.base_manager import BaseManager from .service_endpoint_utils import sanitize_github_repository_fullname class GithubServiceEndpointManager(BaseManager): def __init__(self, organization_name, project_name, creds): super(GithubServiceEndpointManager, self).__init__( creds, organization_name=organization_name, project_name=project_name ) def get_github_service_endpoints(self, repository_fullname): service_endpoint_name = self._get_service_github_endpoint_name(repository_fullname) try: result = self._service_endpoint_client.get_service_endpoints_by_names( self._project_name, [service_endpoint_name], type="github" ) except VstsServiceError: return [] return result def create_github_service_endpoint(self, repository_fullname, github_pat): data = {} auth = models.endpoint_authorization.EndpointAuthorization( parameters={ "accessToken": github_pat }, scheme="PersonalAccessToken" ) service_endpoint_name = self._get_service_github_endpoint_name(repository_fullname) service_endpoint = models.service_endpoint.ServiceEndpoint( administrators_group=None, authorization=auth, data=data, name=service_endpoint_name, type="github", url="http://github.com" ) return self._service_endpoint_client.create_service_endpoint(service_endpoint, self._project_name) def _get_service_github_endpoint_name(self, repository_name): return sanitize_github_repository_fullname(repository_name)
wanton-wind/M-compiler
idea/src/Compiler2018/Parser/MParser.java
// Generated from D:/Coding/M-compiler/idea/src/Compiler2018\M.g4 by ANTLR 4.7 package Compiler2018.Parser; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.ATN; import org.antlr.v4.runtime.atn.ATNDeserializer; import org.antlr.v4.runtime.atn.ParserATNSimulator; import org.antlr.v4.runtime.atn.PredictionContextCache; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.tree.ParseTreeListener; import org.antlr.v4.runtime.tree.TerminalNode; import java.util.List; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class MParser extends Parser { static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int Bool = 1, Int = 2, String = 3, Void = 4, If = 5, Else = 6, For = 7, While = 8, Break = 9, Continue = 10, Return = 11, New = 12, Class = 13, Add = 14, Sub = 15, Mul = 16, Div = 17, Mod = 18, LT = 19, GT = 20, LE = 21, GE = 22, EQ = 23, NE = 24, And = 25, Or = 26, Not = 27, LShift = 28, RShift = 29, BNot = 30, BOr = 31, BXor = 32, BAnd = 33, Assign = 34, AddAdd = 35, SubSub = 36, Semi = 37, Comma = 38, Dot = 39, LParen = 40, RParen = 41, LBracket = 42, RBracket = 43, LBrace = 44, RBrace = 45, BoolConst = 46, NumConst = 47, StrConst = 48, NullConst = 49, Identifier = 50, WhiteSpace = 51, LineComment = 52, BlockComment = 53; public static final int RULE_program = 0, RULE_programSection = 1, RULE_classDeclaration = 2, RULE_functionDeclaration = 3, RULE_variableDeclaration = 4, RULE_variableDeclarationStatement = 5, RULE_functionParameters = 6, RULE_classBlock = 7, RULE_classBlockItem = 8, RULE_constructorDeclaration = 9, RULE_statement = 10, RULE_blockStatement = 11, RULE_branchStatement = 12, RULE_loopStatement = 13, RULE_jumpStatement = 14, RULE_classType = 15, RULE_arrayClass = 16, RULE_nonArrayClass = 17, RULE_expression = 18, RULE_callParameter = 19, RULE_newObject = 20, RULE_brackets = 21, RULE_constant = 22; public static final String[] ruleNames = { "program", "programSection", "classDeclaration", "functionDeclaration", "variableDeclaration", "variableDeclarationStatement", "functionParameters", "classBlock", "classBlockItem", "constructorDeclaration", "statement", "blockStatement", "branchStatement", "loopStatement", "jumpStatement", "classType", "arrayClass", "nonArrayClass", "expression", "callParameter", "newObject", "brackets", "constant" }; private static final String[] _LITERAL_NAMES = { null, "'bool'", "'int'", "'string'", "'void'", "'if'", "'else'", "'for'", "'while'", "'break'", "'continue'", "'return'", "'new'", "'class'", "'+'", "'-'", "'*'", "'/'", "'%'", "'<'", "'>'", "'<='", "'>='", "'=='", "'!='", "'&&'", "'||'", "'!'", "'<<'", "'>>'", "'~'", "'|'", "'^'", "'&'", "'='", "'++'", "'--'", "';'", "','", "'.'", "'('", "')'", "'['", "']'", "'{'", "'}'", null, null, null, "'null'" }; private static final String[] _SYMBOLIC_NAMES = { null, "Bool", "Int", "String", "Void", "If", "Else", "For", "While", "Break", "Continue", "Return", "New", "IRClass", "Add", "Sub", "Mul", "Div", "Mod", "LT", "GT", "LE", "GE", "EQ", "NE", "And", "Or", "Not", "LShift", "RShift", "BNot", "BOr", "BXor", "BAnd", "Assign", "AddAdd", "SubSub", "Semi", "Comma", "Dot", "LParen", "RParen", "LBracket", "RBracket", "LBrace", "RBrace", "BoolConst", "NumConst", "StrConst", "NullConst", "Identifier", "WhiteSpace", "LineComment", "BlockComment" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = "<INVALID>"; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } @Override public String getGrammarFileName() { return "M.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public ATN getATN() { return _ATN; } public MParser(TokenStream input) { super(input); _interp = new ParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); } public static class ProgramContext extends ParserRuleContext { public TerminalNode EOF() { return getToken(MParser.EOF, 0); } public List<ProgramSectionContext> programSection() { return getRuleContexts(ProgramSectionContext.class); } public ProgramSectionContext programSection(int i) { return getRuleContext(ProgramSectionContext.class, i); } public ProgramContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_program; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterProgram(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitProgram(this); } } public final ProgramContext program() throws RecognitionException { ProgramContext _localctx = new ProgramContext(_ctx, getState()); enterRule(_localctx, 0, RULE_program); int _la; try { enterOuterAlt(_localctx, 1); { setState(49); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Bool) | (1L << Int) | (1L << String) | (1L << Void) | (1L << Class) | (1L << Identifier))) != 0)) { { { setState(46); programSection(); } } setState(51); _errHandler.sync(this); _la = _input.LA(1); } setState(52); match(EOF); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ProgramSectionContext extends ParserRuleContext { public ProgramSectionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_programSection; } public ProgramSectionContext() { } public void copyFrom(ProgramSectionContext ctx) { super.copyFrom(ctx); } } public static class ClassDeclContext extends ProgramSectionContext { public ClassDeclarationContext classDeclaration() { return getRuleContext(ClassDeclarationContext.class, 0); } public ClassDeclContext(ProgramSectionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterClassDecl(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitClassDecl(this); } } public static class VarDeclContext extends ProgramSectionContext { public VariableDeclarationStatementContext variableDeclarationStatement() { return getRuleContext(VariableDeclarationStatementContext.class, 0); } public VarDeclContext(ProgramSectionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterVarDecl(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitVarDecl(this); } } public static class FuncDeclContext extends ProgramSectionContext { public FunctionDeclarationContext functionDeclaration() { return getRuleContext(FunctionDeclarationContext.class, 0); } public FuncDeclContext(ProgramSectionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterFuncDecl(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitFuncDecl(this); } } public final ProgramSectionContext programSection() throws RecognitionException { ProgramSectionContext _localctx = new ProgramSectionContext(_ctx, getState()); enterRule(_localctx, 2, RULE_programSection); try { setState(57); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 1, _ctx)) { case 1: _localctx = new ClassDeclContext(_localctx); enterOuterAlt(_localctx, 1); { setState(54); classDeclaration(); } break; case 2: _localctx = new FuncDeclContext(_localctx); enterOuterAlt(_localctx, 2); { setState(55); functionDeclaration(); } break; case 3: _localctx = new VarDeclContext(_localctx); enterOuterAlt(_localctx, 3); { setState(56); variableDeclarationStatement(); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ClassDeclarationContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public ClassBlockContext classBlock() { return getRuleContext(ClassBlockContext.class, 0); } public ClassDeclarationContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_classDeclaration; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterClassDeclaration(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitClassDeclaration(this); } } public final ClassDeclarationContext classDeclaration() throws RecognitionException { ClassDeclarationContext _localctx = new ClassDeclarationContext(_ctx, getState()); enterRule(_localctx, 4, RULE_classDeclaration); try { enterOuterAlt(_localctx, 1); { setState(59); match(Class); setState(60); match(Identifier); setState(61); classBlock(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class FunctionDeclarationContext extends ParserRuleContext { public ClassTypeContext classType() { return getRuleContext(ClassTypeContext.class, 0); } public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public BlockStatementContext blockStatement() { return getRuleContext(BlockStatementContext.class, 0); } public FunctionParametersContext functionParameters() { return getRuleContext(FunctionParametersContext.class, 0); } public FunctionDeclarationContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_functionDeclaration; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterFunctionDeclaration(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitFunctionDeclaration(this); } } public final FunctionDeclarationContext functionDeclaration() throws RecognitionException { FunctionDeclarationContext _localctx = new FunctionDeclarationContext(_ctx, getState()); enterRule(_localctx, 6, RULE_functionDeclaration); int _la; try { enterOuterAlt(_localctx, 1); { setState(63); classType(); setState(64); match(Identifier); setState(65); match(LParen); setState(67); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Bool) | (1L << Int) | (1L << String) | (1L << Void) | (1L << Identifier))) != 0)) { { setState(66); functionParameters(); } } setState(69); match(RParen); setState(70); blockStatement(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class VariableDeclarationContext extends ParserRuleContext { public ClassTypeContext classType() { return getRuleContext(ClassTypeContext.class, 0); } public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public VariableDeclarationContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_variableDeclaration; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterVariableDeclaration(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitVariableDeclaration(this); } } public final VariableDeclarationContext variableDeclaration() throws RecognitionException { VariableDeclarationContext _localctx = new VariableDeclarationContext(_ctx, getState()); enterRule(_localctx, 8, RULE_variableDeclaration); int _la; try { enterOuterAlt(_localctx, 1); { setState(72); classType(); setState(73); match(Identifier); setState(76); _errHandler.sync(this); _la = _input.LA(1); if (_la == Assign) { { setState(74); match(Assign); setState(75); expression(0); } } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class VariableDeclarationStatementContext extends ParserRuleContext { public VariableDeclarationContext variableDeclaration() { return getRuleContext(VariableDeclarationContext.class, 0); } public VariableDeclarationStatementContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_variableDeclarationStatement; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterVariableDeclarationStatement(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitVariableDeclarationStatement(this); } } public final VariableDeclarationStatementContext variableDeclarationStatement() throws RecognitionException { VariableDeclarationStatementContext _localctx = new VariableDeclarationStatementContext(_ctx, getState()); enterRule(_localctx, 10, RULE_variableDeclarationStatement); try { enterOuterAlt(_localctx, 1); { setState(78); variableDeclaration(); setState(79); match(Semi); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class FunctionParametersContext extends ParserRuleContext { public List<VariableDeclarationContext> variableDeclaration() { return getRuleContexts(VariableDeclarationContext.class); } public VariableDeclarationContext variableDeclaration(int i) { return getRuleContext(VariableDeclarationContext.class, i); } public FunctionParametersContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_functionParameters; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterFunctionParameters(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitFunctionParameters(this); } } public final FunctionParametersContext functionParameters() throws RecognitionException { FunctionParametersContext _localctx = new FunctionParametersContext(_ctx, getState()); enterRule(_localctx, 12, RULE_functionParameters); try { int _alt; enterOuterAlt(_localctx, 1); { setState(86); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 4, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { { { setState(81); variableDeclaration(); setState(82); match(Comma); } } } setState(88); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 4, _ctx); } setState(89); variableDeclaration(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ClassBlockContext extends ParserRuleContext { public List<ClassBlockItemContext> classBlockItem() { return getRuleContexts(ClassBlockItemContext.class); } public ClassBlockItemContext classBlockItem(int i) { return getRuleContext(ClassBlockItemContext.class, i); } public ClassBlockContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_classBlock; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterClassBlock(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitClassBlock(this); } } public final ClassBlockContext classBlock() throws RecognitionException { ClassBlockContext _localctx = new ClassBlockContext(_ctx, getState()); enterRule(_localctx, 14, RULE_classBlock); int _la; try { enterOuterAlt(_localctx, 1); { setState(91); match(LBrace); setState(95); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Bool) | (1L << Int) | (1L << String) | (1L << Void) | (1L << Identifier))) != 0)) { { { setState(92); classBlockItem(); } } setState(97); _errHandler.sync(this); _la = _input.LA(1); } setState(98); match(RBrace); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ClassBlockItemContext extends ParserRuleContext { public ClassBlockItemContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_classBlockItem; } public ClassBlockItemContext() { } public void copyFrom(ClassBlockItemContext ctx) { super.copyFrom(ctx); } } public static class ClassCstrDeclContext extends ClassBlockItemContext { public ConstructorDeclarationContext constructorDeclaration() { return getRuleContext(ConstructorDeclarationContext.class, 0); } public ClassCstrDeclContext(ClassBlockItemContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterClassCstrDecl(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitClassCstrDecl(this); } } public static class ClassFuncDeclContext extends ClassBlockItemContext { public FunctionDeclarationContext functionDeclaration() { return getRuleContext(FunctionDeclarationContext.class, 0); } public ClassFuncDeclContext(ClassBlockItemContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterClassFuncDecl(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitClassFuncDecl(this); } } public static class ClassVarDeclContext extends ClassBlockItemContext { public VariableDeclarationStatementContext variableDeclarationStatement() { return getRuleContext(VariableDeclarationStatementContext.class, 0); } public ClassVarDeclContext(ClassBlockItemContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterClassVarDecl(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitClassVarDecl(this); } } public final ClassBlockItemContext classBlockItem() throws RecognitionException { ClassBlockItemContext _localctx = new ClassBlockItemContext(_ctx, getState()); enterRule(_localctx, 16, RULE_classBlockItem); try { setState(103); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 6, _ctx)) { case 1: _localctx = new ClassVarDeclContext(_localctx); enterOuterAlt(_localctx, 1); { setState(100); variableDeclarationStatement(); } break; case 2: _localctx = new ClassCstrDeclContext(_localctx); enterOuterAlt(_localctx, 2); { setState(101); constructorDeclaration(); } break; case 3: _localctx = new ClassFuncDeclContext(_localctx); enterOuterAlt(_localctx, 3); { setState(102); functionDeclaration(); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ConstructorDeclarationContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public BlockStatementContext blockStatement() { return getRuleContext(BlockStatementContext.class, 0); } public FunctionParametersContext functionParameters() { return getRuleContext(FunctionParametersContext.class, 0); } public ConstructorDeclarationContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_constructorDeclaration; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterConstructorDeclaration(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitConstructorDeclaration(this); } } public final ConstructorDeclarationContext constructorDeclaration() throws RecognitionException { ConstructorDeclarationContext _localctx = new ConstructorDeclarationContext(_ctx, getState()); enterRule(_localctx, 18, RULE_constructorDeclaration); int _la; try { enterOuterAlt(_localctx, 1); { setState(105); match(Identifier); setState(106); match(LParen); setState(108); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Bool) | (1L << Int) | (1L << String) | (1L << Void) | (1L << Identifier))) != 0)) { { setState(107); functionParameters(); } } setState(110); match(RParen); setState(111); blockStatement(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class StatementContext extends ParserRuleContext { public StatementContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_statement; } public StatementContext() { } public void copyFrom(StatementContext ctx) { super.copyFrom(ctx); } } public static class BranchStmtContext extends StatementContext { public BranchStatementContext branchStatement() { return getRuleContext(BranchStatementContext.class, 0); } public BranchStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBranchStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBranchStmt(this); } } public static class LoopStmtContext extends StatementContext { public LoopStatementContext loopStatement() { return getRuleContext(LoopStatementContext.class, 0); } public LoopStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterLoopStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitLoopStmt(this); } } public static class ExprStmtContext extends StatementContext { public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public ExprStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterExprStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitExprStmt(this); } } public static class JumpStmtContext extends StatementContext { public JumpStatementContext jumpStatement() { return getRuleContext(JumpStatementContext.class, 0); } public JumpStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterJumpStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitJumpStmt(this); } } public static class VarDeclStmtContext extends StatementContext { public VariableDeclarationStatementContext variableDeclarationStatement() { return getRuleContext(VariableDeclarationStatementContext.class, 0); } public VarDeclStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterVarDeclStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitVarDeclStmt(this); } } public static class BlockStmtContext extends StatementContext { public BlockStatementContext blockStatement() { return getRuleContext(BlockStatementContext.class, 0); } public BlockStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBlockStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBlockStmt(this); } } public static class EmptyStmtContext extends StatementContext { public EmptyStmtContext(StatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterEmptyStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitEmptyStmt(this); } } public final StatementContext statement() throws RecognitionException { StatementContext _localctx = new StatementContext(_ctx, getState()); enterRule(_localctx, 20, RULE_statement); try { setState(122); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 8, _ctx)) { case 1: _localctx = new BlockStmtContext(_localctx); enterOuterAlt(_localctx, 1); { setState(113); blockStatement(); } break; case 2: _localctx = new VarDeclStmtContext(_localctx); enterOuterAlt(_localctx, 2); { setState(114); variableDeclarationStatement(); } break; case 3: _localctx = new BranchStmtContext(_localctx); enterOuterAlt(_localctx, 3); { setState(115); branchStatement(); } break; case 4: _localctx = new LoopStmtContext(_localctx); enterOuterAlt(_localctx, 4); { setState(116); loopStatement(); } break; case 5: _localctx = new ExprStmtContext(_localctx); enterOuterAlt(_localctx, 5); { setState(117); expression(0); setState(118); match(Semi); } break; case 6: _localctx = new JumpStmtContext(_localctx); enterOuterAlt(_localctx, 6); { setState(120); jumpStatement(); } break; case 7: _localctx = new EmptyStmtContext(_localctx); enterOuterAlt(_localctx, 7); { setState(121); match(Semi); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class BlockStatementContext extends ParserRuleContext { public List<StatementContext> statement() { return getRuleContexts(StatementContext.class); } public StatementContext statement(int i) { return getRuleContext(StatementContext.class, i); } public BlockStatementContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_blockStatement; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBlockStatement(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBlockStatement(this); } } public final BlockStatementContext blockStatement() throws RecognitionException { BlockStatementContext _localctx = new BlockStatementContext(_ctx, getState()); enterRule(_localctx, 22, RULE_blockStatement); int _la; try { enterOuterAlt(_localctx, 1); { setState(124); match(LBrace); setState(128); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Bool) | (1L << Int) | (1L << String) | (1L << Void) | (1L << If) | (1L << For) | (1L << While) | (1L << Break) | (1L << Continue) | (1L << Return) | (1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << Semi) | (1L << LParen) | (1L << LBrace) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { { setState(125); statement(); } } setState(130); _errHandler.sync(this); _la = _input.LA(1); } setState(131); match(RBrace); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class BranchStatementContext extends ParserRuleContext { public TerminalNode If() { return getToken(MParser.If, 0); } public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public List<StatementContext> statement() { return getRuleContexts(StatementContext.class); } public StatementContext statement(int i) { return getRuleContext(StatementContext.class, i); } public TerminalNode Else() { return getToken(MParser.Else, 0); } public BranchStatementContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_branchStatement; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBranchStatement(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBranchStatement(this); } } public final BranchStatementContext branchStatement() throws RecognitionException { BranchStatementContext _localctx = new BranchStatementContext(_ctx, getState()); enterRule(_localctx, 24, RULE_branchStatement); try { enterOuterAlt(_localctx, 1); { setState(133); match(If); setState(134); match(LParen); setState(135); expression(0); setState(136); match(RParen); setState(137); statement(); setState(140); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 10, _ctx)) { case 1: { setState(138); match(Else); setState(139); statement(); } break; } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class LoopStatementContext extends ParserRuleContext { public LoopStatementContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_loopStatement; } public LoopStatementContext() { } public void copyFrom(LoopStatementContext ctx) { super.copyFrom(ctx); } } public static class WhileStmtContext extends LoopStatementContext { public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public StatementContext statement() { return getRuleContext(StatementContext.class, 0); } public WhileStmtContext(LoopStatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterWhileStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitWhileStmt(this); } } public static class ForStmtContext extends LoopStatementContext { public ExpressionContext init; public ExpressionContext cond; public ExpressionContext step; public StatementContext statement() { return getRuleContext(StatementContext.class, 0); } public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class, i); } public ForStmtContext(LoopStatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterForStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitForStmt(this); } } public final LoopStatementContext loopStatement() throws RecognitionException { LoopStatementContext _localctx = new LoopStatementContext(_ctx, getState()); enterRule(_localctx, 26, RULE_loopStatement); int _la; try { setState(163); _errHandler.sync(this); switch (_input.LA(1)) { case For: _localctx = new ForStmtContext(_localctx); enterOuterAlt(_localctx, 1); { setState(142); match(For); setState(143); match(LParen); setState(145); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << LParen) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { setState(144); ((ForStmtContext) _localctx).init = expression(0); } } setState(147); match(Semi); setState(149); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << LParen) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { setState(148); ((ForStmtContext) _localctx).cond = expression(0); } } setState(151); match(Semi); setState(153); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << LParen) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { setState(152); ((ForStmtContext) _localctx).step = expression(0); } } setState(155); match(RParen); setState(156); statement(); } break; case While: _localctx = new WhileStmtContext(_localctx); enterOuterAlt(_localctx, 2); { setState(157); match(While); setState(158); match(LParen); setState(159); expression(0); setState(160); match(RParen); setState(161); statement(); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class JumpStatementContext extends ParserRuleContext { public JumpStatementContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_jumpStatement; } public JumpStatementContext() { } public void copyFrom(JumpStatementContext ctx) { super.copyFrom(ctx); } } public static class ContinueStmtContext extends JumpStatementContext { public ContinueStmtContext(JumpStatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterContinueStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitContinueStmt(this); } } public static class BreakStmtContext extends JumpStatementContext { public BreakStmtContext(JumpStatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBreakStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBreakStmt(this); } } public static class ReturnStmtContext extends JumpStatementContext { public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public ReturnStmtContext(JumpStatementContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterReturnStmt(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitReturnStmt(this); } } public final JumpStatementContext jumpStatement() throws RecognitionException { JumpStatementContext _localctx = new JumpStatementContext(_ctx, getState()); enterRule(_localctx, 28, RULE_jumpStatement); int _la; try { setState(174); _errHandler.sync(this); switch (_input.LA(1)) { case Return: _localctx = new ReturnStmtContext(_localctx); enterOuterAlt(_localctx, 1); { setState(165); match(Return); setState(167); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << LParen) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { setState(166); expression(0); } } setState(169); match(Semi); } break; case Break: _localctx = new BreakStmtContext(_localctx); enterOuterAlt(_localctx, 2); { setState(170); match(Break); setState(171); match(Semi); } break; case Continue: _localctx = new ContinueStmtContext(_localctx); enterOuterAlt(_localctx, 3); { setState(172); match(Continue); setState(173); match(Semi); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ClassTypeContext extends ParserRuleContext { public ClassTypeContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_classType; } public ClassTypeContext() { } public void copyFrom(ClassTypeContext ctx) { super.copyFrom(ctx); } } public static class ArrayTypeContext extends ClassTypeContext { public ArrayClassContext arrayClass() { return getRuleContext(ArrayClassContext.class, 0); } public ArrayTypeContext(ClassTypeContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterArrayType(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitArrayType(this); } } public static class NonArrayTypeContext extends ClassTypeContext { public NonArrayClassContext nonArrayClass() { return getRuleContext(NonArrayClassContext.class, 0); } public NonArrayTypeContext(ClassTypeContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterNonArrayType(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitNonArrayType(this); } } public final ClassTypeContext classType() throws RecognitionException { ClassTypeContext _localctx = new ClassTypeContext(_ctx, getState()); enterRule(_localctx, 30, RULE_classType); try { setState(178); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 17, _ctx)) { case 1: _localctx = new ArrayTypeContext(_localctx); enterOuterAlt(_localctx, 1); { setState(176); arrayClass(); } break; case 2: _localctx = new NonArrayTypeContext(_localctx); enterOuterAlt(_localctx, 2); { setState(177); nonArrayClass(); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ArrayClassContext extends ParserRuleContext { public NonArrayClassContext nonArrayClass() { return getRuleContext(NonArrayClassContext.class, 0); } public List<BracketsContext> brackets() { return getRuleContexts(BracketsContext.class); } public BracketsContext brackets(int i) { return getRuleContext(BracketsContext.class, i); } public ArrayClassContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_arrayClass; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterArrayClass(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitArrayClass(this); } } public final ArrayClassContext arrayClass() throws RecognitionException { ArrayClassContext _localctx = new ArrayClassContext(_ctx, getState()); enterRule(_localctx, 32, RULE_arrayClass); int _la; try { enterOuterAlt(_localctx, 1); { setState(180); nonArrayClass(); setState(182); _errHandler.sync(this); _la = _input.LA(1); do { { { setState(181); brackets(); } } setState(184); _errHandler.sync(this); _la = _input.LA(1); } while (_la == LBracket); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class NonArrayClassContext extends ParserRuleContext { public Token type; public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public NonArrayClassContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_nonArrayClass; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterNonArrayClass(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitNonArrayClass(this); } } public final NonArrayClassContext nonArrayClass() throws RecognitionException { NonArrayClassContext _localctx = new NonArrayClassContext(_ctx, getState()); enterRule(_localctx, 34, RULE_nonArrayClass); try { setState(191); _errHandler.sync(this); switch (_input.LA(1)) { case Bool: enterOuterAlt(_localctx, 1); { setState(186); ((NonArrayClassContext) _localctx).type = match(Bool); } break; case Int: enterOuterAlt(_localctx, 2); { setState(187); ((NonArrayClassContext) _localctx).type = match(Int); } break; case Void: enterOuterAlt(_localctx, 3); { setState(188); ((NonArrayClassContext) _localctx).type = match(Void); } break; case String: enterOuterAlt(_localctx, 4); { setState(189); ((NonArrayClassContext) _localctx).type = match(String); } break; case Identifier: enterOuterAlt(_localctx, 5); { setState(190); ((NonArrayClassContext) _localctx).type = match(Identifier); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ExpressionContext extends ParserRuleContext { public ExpressionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_expression; } public ExpressionContext() { } public void copyFrom(ExpressionContext ctx) { super.copyFrom(ctx); } } public static class IdentifierContext extends ExpressionContext { public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public IdentifierContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterIdentifier(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitIdentifier(this); } } public static class MemberAcessContext extends ExpressionContext { public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public TerminalNode Identifier() { return getToken(MParser.Identifier, 0); } public MemberAcessContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterMemberAcess(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitMemberAcess(this); } } public static class ArrayAcessContext extends ExpressionContext { public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class, i); } public ArrayAcessContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterArrayAcess(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitArrayAcess(this); } } public static class ConstContext extends ExpressionContext { public ConstantContext constant() { return getRuleContext(ConstantContext.class, 0); } public ConstContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterConst(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitConst(this); } } public static class SubExprContext extends ExpressionContext { public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public SubExprContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterSubExpr(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitSubExpr(this); } } public static class BinaryExprContext extends ExpressionContext { public Token op; public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class, i); } public BinaryExprContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBinaryExpr(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBinaryExpr(this); } } public static class NewExprContext extends ExpressionContext { public NewObjectContext newObject() { return getRuleContext(NewObjectContext.class, 0); } public NewExprContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterNewExpr(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitNewExpr(this); } } public static class FunctionCallContext extends ExpressionContext { public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public CallParameterContext callParameter() { return getRuleContext(CallParameterContext.class, 0); } public FunctionCallContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterFunctionCall(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitFunctionCall(this); } } public static class PostfixIncDecContext extends ExpressionContext { public Token op; public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public PostfixIncDecContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterPostfixIncDec(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitPostfixIncDec(this); } } public static class UnaryExprContext extends ExpressionContext { public Token op; public ExpressionContext expression() { return getRuleContext(ExpressionContext.class, 0); } public UnaryExprContext(ExpressionContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterUnaryExpr(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitUnaryExpr(this); } } public final ExpressionContext expression() throws RecognitionException { return expression(0); } private ExpressionContext expression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; int _startState = 36; enterRecursionRule(_localctx, 36, RULE_expression, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); { setState(208); _errHandler.sync(this); switch (_input.LA(1)) { case AddAdd: case SubSub: { _localctx = new UnaryExprContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(194); ((UnaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == AddAdd || _la == SubSub)) { ((UnaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(195); expression(18); } break; case Add: case Sub: { _localctx = new UnaryExprContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(196); ((UnaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == Add || _la == Sub)) { ((UnaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(197); expression(17); } break; case Not: case BNot: { _localctx = new UnaryExprContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(198); ((UnaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == Not || _la == BNot)) { ((UnaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(199); expression(16); } break; case New: { _localctx = new NewExprContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(200); match(New); setState(201); newObject(); } break; case Identifier: { _localctx = new IdentifierContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(202); match(Identifier); } break; case BoolConst: case NumConst: case StrConst: case NullConst: { _localctx = new ConstContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(203); constant(); } break; case LParen: { _localctx = new SubExprContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(204); match(LParen); setState(205); expression(0); setState(206); match(RParen); } break; default: throw new NoViableAltException(this); } _ctx.stop = _input.LT(-1); setState(261); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 23, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(259); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 22, _ctx)) { case 1: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(210); if (!(precpred(_ctx, 14))) throw new FailedPredicateException(this, "precpred(_ctx, 14)"); setState(211); ((BinaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Mul) | (1L << Div) | (1L << Mod))) != 0))) { ((BinaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(212); expression(15); } break; case 2: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(213); if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)"); setState(214); ((BinaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == Add || _la == Sub)) { ((BinaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(215); expression(14); } break; case 3: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(216); if (!(precpred(_ctx, 12))) throw new FailedPredicateException(this, "precpred(_ctx, 12)"); setState(217); ((BinaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == LShift || _la == RShift)) { ((BinaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(218); expression(13); } break; case 4: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(219); if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)"); setState(220); ((BinaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << LT) | (1L << GT) | (1L << LE) | (1L << GE))) != 0))) { ((BinaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(221); expression(12); } break; case 5: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(222); if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)"); setState(223); ((BinaryExprContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == EQ || _la == NE)) { ((BinaryExprContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } setState(224); expression(11); } break; case 6: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(225); if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)"); setState(226); ((BinaryExprContext) _localctx).op = match(BAnd); setState(227); expression(10); } break; case 7: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(228); if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); setState(229); ((BinaryExprContext) _localctx).op = match(BXor); setState(230); expression(9); } break; case 8: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(231); if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); setState(232); ((BinaryExprContext) _localctx).op = match(BOr); setState(233); expression(8); } break; case 9: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(234); if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); setState(235); ((BinaryExprContext) _localctx).op = match(And); setState(236); expression(7); } break; case 10: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(237); if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)"); setState(238); ((BinaryExprContext) _localctx).op = match(Or); setState(239); expression(6); } break; case 11: { _localctx = new BinaryExprContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(240); if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); setState(241); ((BinaryExprContext) _localctx).op = match(Assign); setState(242); expression(4); } break; case 12: { _localctx = new PostfixIncDecContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(243); if (!(precpred(_ctx, 22))) throw new FailedPredicateException(this, "precpred(_ctx, 22)"); setState(244); ((PostfixIncDecContext) _localctx).op = _input.LT(1); _la = _input.LA(1); if (!(_la == AddAdd || _la == SubSub)) { ((PostfixIncDecContext) _localctx).op = (Token) _errHandler.recoverInline(this); } else { if (_input.LA(1) == Token.EOF) matchedEOF = true; _errHandler.reportMatch(this); consume(); } } break; case 13: { _localctx = new FunctionCallContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(245); if (!(precpred(_ctx, 21))) throw new FailedPredicateException(this, "precpred(_ctx, 21)"); setState(246); match(LParen); setState(248); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << LParen) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { setState(247); callParameter(); } } setState(250); match(RParen); } break; case 14: { _localctx = new ArrayAcessContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(251); if (!(precpred(_ctx, 20))) throw new FailedPredicateException(this, "precpred(_ctx, 20)"); setState(252); match(LBracket); setState(253); expression(0); setState(254); match(RBracket); } break; case 15: { _localctx = new MemberAcessContext(new ExpressionContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(256); if (!(precpred(_ctx, 19))) throw new FailedPredicateException(this, "precpred(_ctx, 19)"); setState(257); match(Dot); setState(258); match(Identifier); } break; } } } setState(263); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 23, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; } public static class CallParameterContext extends ParserRuleContext { public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class, i); } public CallParameterContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_callParameter; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterCallParameter(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitCallParameter(this); } } public final CallParameterContext callParameter() throws RecognitionException { CallParameterContext _localctx = new CallParameterContext(_ctx, getState()); enterRule(_localctx, 38, RULE_callParameter); try { int _alt; enterOuterAlt(_localctx, 1); { setState(269); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 24, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { { { setState(264); expression(0); setState(265); match(Comma); } } } setState(271); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 24, _ctx); } setState(272); expression(0); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class NewObjectContext extends ParserRuleContext { public NewObjectContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_newObject; } public NewObjectContext() { } public void copyFrom(NewObjectContext ctx) { super.copyFrom(ctx); } } public static class NewArrayContext extends NewObjectContext { public NonArrayClassContext nonArrayClass() { return getRuleContext(NonArrayClassContext.class, 0); } public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class, i); } public List<BracketsContext> brackets() { return getRuleContexts(BracketsContext.class); } public BracketsContext brackets(int i) { return getRuleContext(BracketsContext.class, i); } public NewArrayContext(NewObjectContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterNewArray(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitNewArray(this); } } public static class NewNonArrayContext extends NewObjectContext { public NonArrayClassContext nonArrayClass() { return getRuleContext(NonArrayClassContext.class, 0); } public CallParameterContext callParameter() { return getRuleContext(CallParameterContext.class, 0); } public NewNonArrayContext(NewObjectContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterNewNonArray(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitNewNonArray(this); } } public static class NewErrorContext extends NewObjectContext { public NonArrayClassContext nonArrayClass() { return getRuleContext(NonArrayClassContext.class, 0); } public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class, i); } public List<BracketsContext> brackets() { return getRuleContexts(BracketsContext.class); } public BracketsContext brackets(int i) { return getRuleContext(BracketsContext.class, i); } public NewErrorContext(NewObjectContext ctx) { copyFrom(ctx); } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterNewError(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitNewError(this); } } public final NewObjectContext newObject() throws RecognitionException { NewObjectContext _localctx = new NewObjectContext(_ctx, getState()); enterRule(_localctx, 40, RULE_newObject); int _la; try { int _alt; setState(319); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 32, _ctx)) { case 1: _localctx = new NewErrorContext(_localctx); enterOuterAlt(_localctx, 1); { setState(274); nonArrayClass(); setState(279); _errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { setState(275); match(LBracket); setState(276); expression(0); setState(277); match(RBracket); } } break; default: throw new NoViableAltException(this); } setState(281); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 25, _ctx); } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER); setState(284); _errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { setState(283); brackets(); } } break; default: throw new NoViableAltException(this); } setState(286); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 26, _ctx); } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER); setState(292); _errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { setState(288); match(LBracket); setState(289); expression(0); setState(290); match(RBracket); } } break; default: throw new NoViableAltException(this); } setState(294); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 27, _ctx); } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER); } break; case 2: _localctx = new NewArrayContext(_localctx); enterOuterAlt(_localctx, 2); { setState(296); nonArrayClass(); setState(301); _errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { setState(297); match(LBracket); setState(298); expression(0); setState(299); match(RBracket); } } break; default: throw new NoViableAltException(this); } setState(303); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 28, _ctx); } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER); setState(308); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 29, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { { { setState(305); brackets(); } } } setState(310); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 29, _ctx); } } break; case 3: _localctx = new NewNonArrayContext(_localctx); enterOuterAlt(_localctx, 3); { setState(311); nonArrayClass(); setState(317); _errHandler.sync(this); switch (getInterpreter().adaptivePredict(_input, 31, _ctx)) { case 1: { setState(312); match(LParen); setState(314); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << New) | (1L << Add) | (1L << Sub) | (1L << Not) | (1L << BNot) | (1L << AddAdd) | (1L << SubSub) | (1L << LParen) | (1L << BoolConst) | (1L << NumConst) | (1L << StrConst) | (1L << NullConst) | (1L << Identifier))) != 0)) { { setState(313); callParameter(); } } setState(316); match(RParen); } break; } } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class BracketsContext extends ParserRuleContext { public BracketsContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_brackets; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterBrackets(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitBrackets(this); } } public final BracketsContext brackets() throws RecognitionException { BracketsContext _localctx = new BracketsContext(_ctx, getState()); enterRule(_localctx, 42, RULE_brackets); try { enterOuterAlt(_localctx, 1); { setState(321); match(LBracket); setState(322); match(RBracket); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ConstantContext extends ParserRuleContext { public Token type; public TerminalNode BoolConst() { return getToken(MParser.BoolConst, 0); } public TerminalNode NumConst() { return getToken(MParser.NumConst, 0); } public TerminalNode StrConst() { return getToken(MParser.StrConst, 0); } public TerminalNode NullConst() { return getToken(MParser.NullConst, 0); } public ConstantContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_constant; } @Override public void enterRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).enterConstant(this); } @Override public void exitRule(ParseTreeListener listener) { if (listener instanceof MListener) ((MListener) listener).exitConstant(this); } } public final ConstantContext constant() throws RecognitionException { ConstantContext _localctx = new ConstantContext(_ctx, getState()); enterRule(_localctx, 44, RULE_constant); try { setState(328); _errHandler.sync(this); switch (_input.LA(1)) { case BoolConst: enterOuterAlt(_localctx, 1); { setState(324); ((ConstantContext) _localctx).type = match(BoolConst); } break; case NumConst: enterOuterAlt(_localctx, 2); { setState(325); ((ConstantContext) _localctx).type = match(NumConst); } break; case StrConst: enterOuterAlt(_localctx, 3); { setState(326); ((ConstantContext) _localctx).type = match(StrConst); } break; case NullConst: enterOuterAlt(_localctx, 4); { setState(327); ((ConstantContext) _localctx).type = match(NullConst); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 18: return expression_sempred((ExpressionContext) _localctx, predIndex); } return true; } private boolean expression_sempred(ExpressionContext _localctx, int predIndex) { switch (predIndex) { case 0: return precpred(_ctx, 14); case 1: return precpred(_ctx, 13); case 2: return precpred(_ctx, 12); case 3: return precpred(_ctx, 11); case 4: return precpred(_ctx, 10); case 5: return precpred(_ctx, 9); case 6: return precpred(_ctx, 8); case 7: return precpred(_ctx, 7); case 8: return precpred(_ctx, 6); case 9: return precpred(_ctx, 5); case 10: return precpred(_ctx, 4); case 11: return precpred(_ctx, 22); case 12: return precpred(_ctx, 21); case 13: return precpred(_ctx, 20); case 14: return precpred(_ctx, 19); } return true; } public static final String _serializedATN = "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\67\u014d\4\2\t\2" + "\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13" + "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22" + "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\3\2\7\2\62" + "\n\2\f\2\16\2\65\13\2\3\2\3\2\3\3\3\3\3\3\5\3<\n\3\3\4\3\4\3\4\3\4\3\5" + "\3\5\3\5\3\5\5\5F\n\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\5\6O\n\6\3\7\3\7\3\7" + "\3\b\3\b\3\b\7\bW\n\b\f\b\16\bZ\13\b\3\b\3\b\3\t\3\t\7\t`\n\t\f\t\16\t" + "c\13\t\3\t\3\t\3\n\3\n\3\n\5\nj\n\n\3\13\3\13\3\13\5\13o\n\13\3\13\3\13" + "\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f}\n\f\3\r\3\r\7\r\u0081\n" + "\r\f\r\16\r\u0084\13\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\16\3\16\5\16" + "\u008f\n\16\3\17\3\17\3\17\5\17\u0094\n\17\3\17\3\17\5\17\u0098\n\17\3" + "\17\3\17\5\17\u009c\n\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\5\17" + "\u00a6\n\17\3\20\3\20\5\20\u00aa\n\20\3\20\3\20\3\20\3\20\3\20\5\20\u00b1" + "\n\20\3\21\3\21\5\21\u00b5\n\21\3\22\3\22\6\22\u00b9\n\22\r\22\16\22\u00ba" + "\3\23\3\23\3\23\3\23\3\23\5\23\u00c2\n\23\3\24\3\24\3\24\3\24\3\24\3\24" + "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u00d3\n\24\3\24\3\24" + "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24" + "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24" + "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u00fb\n\24\3\24\3\24\3\24" + "\3\24\3\24\3\24\3\24\3\24\3\24\7\24\u0106\n\24\f\24\16\24\u0109\13\24" + "\3\25\3\25\3\25\7\25\u010e\n\25\f\25\16\25\u0111\13\25\3\25\3\25\3\26" + "\3\26\3\26\3\26\3\26\6\26\u011a\n\26\r\26\16\26\u011b\3\26\6\26\u011f" + "\n\26\r\26\16\26\u0120\3\26\3\26\3\26\3\26\6\26\u0127\n\26\r\26\16\26" + "\u0128\3\26\3\26\3\26\3\26\3\26\6\26\u0130\n\26\r\26\16\26\u0131\3\26" + "\7\26\u0135\n\26\f\26\16\26\u0138\13\26\3\26\3\26\3\26\5\26\u013d\n\26" + "\3\26\5\26\u0140\n\26\5\26\u0142\n\26\3\27\3\27\3\27\3\30\3\30\3\30\3" + "\30\5\30\u014b\n\30\3\30\2\3&\31\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36" + " \"$&(*,.\2\t\3\2%&\3\2\20\21\4\2\35\35 \3\2\22\24\3\2\36\37\3\2\25\30" + "\3\2\31\32\2\u0177\2\63\3\2\2\2\4;\3\2\2\2\6=\3\2\2\2\bA\3\2\2\2\nJ\3" + "\2\2\2\fP\3\2\2\2\16X\3\2\2\2\20]\3\2\2\2\22i\3\2\2\2\24k\3\2\2\2\26|" + "\3\2\2\2\30~\3\2\2\2\32\u0087\3\2\2\2\34\u00a5\3\2\2\2\36\u00b0\3\2\2" + "\2 \u00b4\3\2\2\2\"\u00b6\3\2\2\2$\u00c1\3\2\2\2&\u00d2\3\2\2\2(\u010f" + "\3\2\2\2*\u0141\3\2\2\2,\u0143\3\2\2\2.\u014a\3\2\2\2\60\62\5\4\3\2\61" + "\60\3\2\2\2\62\65\3\2\2\2\63\61\3\2\2\2\63\64\3\2\2\2\64\66\3\2\2\2\65" + "\63\3\2\2\2\66\67\7\2\2\3\67\3\3\2\2\28<\5\6\4\29<\5\b\5\2:<\5\f\7\2;" + "8\3\2\2\2;9\3\2\2\2;:\3\2\2\2<\5\3\2\2\2=>\7\17\2\2>?\7\64\2\2?@\5\20" + "\t\2@\7\3\2\2\2AB\5 \21\2BC\7\64\2\2CE\7*\2\2DF\5\16\b\2ED\3\2\2\2EF\3" + "\2\2\2FG\3\2\2\2GH\7+\2\2HI\5\30\r\2I\t\3\2\2\2JK\5 \21\2KN\7\64\2\2L" + "M\7$\2\2MO\5&\24\2NL\3\2\2\2NO\3\2\2\2O\13\3\2\2\2PQ\5\n\6\2QR\7\'\2\2" + "R\r\3\2\2\2ST\5\n\6\2TU\7(\2\2UW\3\2\2\2VS\3\2\2\2WZ\3\2\2\2XV\3\2\2\2" + "XY\3\2\2\2Y[\3\2\2\2ZX\3\2\2\2[\\\5\n\6\2\\\17\3\2\2\2]a\7.\2\2^`\5\22" + "\n\2_^\3\2\2\2`c\3\2\2\2a_\3\2\2\2ab\3\2\2\2bd\3\2\2\2ca\3\2\2\2de\7/" + "\2\2e\21\3\2\2\2fj\5\f\7\2gj\5\24\13\2hj\5\b\5\2if\3\2\2\2ig\3\2\2\2i" + "h\3\2\2\2j\23\3\2\2\2kl\7\64\2\2ln\7*\2\2mo\5\16\b\2nm\3\2\2\2no\3\2\2" + "\2op\3\2\2\2pq\7+\2\2qr\5\30\r\2r\25\3\2\2\2s}\5\30\r\2t}\5\f\7\2u}\5" + "\32\16\2v}\5\34\17\2wx\5&\24\2xy\7\'\2\2y}\3\2\2\2z}\5\36\20\2{}\7\'\2" + "\2|s\3\2\2\2|t\3\2\2\2|u\3\2\2\2|v\3\2\2\2|w\3\2\2\2|z\3\2\2\2|{\3\2\2" + "\2}\27\3\2\2\2~\u0082\7.\2\2\177\u0081\5\26\f\2\u0080\177\3\2\2\2\u0081" + "\u0084\3\2\2\2\u0082\u0080\3\2\2\2\u0082\u0083\3\2\2\2\u0083\u0085\3\2" + "\2\2\u0084\u0082\3\2\2\2\u0085\u0086\7/\2\2\u0086\31\3\2\2\2\u0087\u0088" + "\7\7\2\2\u0088\u0089\7*\2\2\u0089\u008a\5&\24\2\u008a\u008b\7+\2\2\u008b" + "\u008e\5\26\f\2\u008c\u008d\7\b\2\2\u008d\u008f\5\26\f\2\u008e\u008c\3" + "\2\2\2\u008e\u008f\3\2\2\2\u008f\33\3\2\2\2\u0090\u0091\7\t\2\2\u0091" + "\u0093\7*\2\2\u0092\u0094\5&\24\2\u0093\u0092\3\2\2\2\u0093\u0094\3\2" + "\2\2\u0094\u0095\3\2\2\2\u0095\u0097\7\'\2\2\u0096\u0098\5&\24\2\u0097" + "\u0096\3\2\2\2\u0097\u0098\3\2\2\2\u0098\u0099\3\2\2\2\u0099\u009b\7\'" + "\2\2\u009a\u009c\5&\24\2\u009b\u009a\3\2\2\2\u009b\u009c\3\2\2\2\u009c" + "\u009d\3\2\2\2\u009d\u009e\7+\2\2\u009e\u00a6\5\26\f\2\u009f\u00a0\7\n" + "\2\2\u00a0\u00a1\7*\2\2\u00a1\u00a2\5&\24\2\u00a2\u00a3\7+\2\2\u00a3\u00a4" + "\5\26\f\2\u00a4\u00a6\3\2\2\2\u00a5\u0090\3\2\2\2\u00a5\u009f\3\2\2\2" + "\u00a6\35\3\2\2\2\u00a7\u00a9\7\r\2\2\u00a8\u00aa\5&\24\2\u00a9\u00a8" + "\3\2\2\2\u00a9\u00aa\3\2\2\2\u00aa\u00ab\3\2\2\2\u00ab\u00b1\7\'\2\2\u00ac" + "\u00ad\7\13\2\2\u00ad\u00b1\7\'\2\2\u00ae\u00af\7\f\2\2\u00af\u00b1\7" + "\'\2\2\u00b0\u00a7\3\2\2\2\u00b0\u00ac\3\2\2\2\u00b0\u00ae\3\2\2\2\u00b1" + "\37\3\2\2\2\u00b2\u00b5\5\"\22\2\u00b3\u00b5\5$\23\2\u00b4\u00b2\3\2\2" + "\2\u00b4\u00b3\3\2\2\2\u00b5!\3\2\2\2\u00b6\u00b8\5$\23\2\u00b7\u00b9" + "\5,\27\2\u00b8\u00b7\3\2\2\2\u00b9\u00ba\3\2\2\2\u00ba\u00b8\3\2\2\2\u00ba" + "\u00bb\3\2\2\2\u00bb#\3\2\2\2\u00bc\u00c2\7\3\2\2\u00bd\u00c2\7\4\2\2" + "\u00be\u00c2\7\6\2\2\u00bf\u00c2\7\5\2\2\u00c0\u00c2\7\64\2\2\u00c1\u00bc" + "\3\2\2\2\u00c1\u00bd\3\2\2\2\u00c1\u00be\3\2\2\2\u00c1\u00bf\3\2\2\2\u00c1" + "\u00c0\3\2\2\2\u00c2%\3\2\2\2\u00c3\u00c4\b\24\1\2\u00c4\u00c5\t\2\2\2" + "\u00c5\u00d3\5&\24\24\u00c6\u00c7\t\3\2\2\u00c7\u00d3\5&\24\23\u00c8\u00c9" + "\t\4\2\2\u00c9\u00d3\5&\24\22\u00ca\u00cb\7\16\2\2\u00cb\u00d3\5*\26\2" + "\u00cc\u00d3\7\64\2\2\u00cd\u00d3\5.\30\2\u00ce\u00cf\7*\2\2\u00cf\u00d0" + "\5&\24\2\u00d0\u00d1\7+\2\2\u00d1\u00d3\3\2\2\2\u00d2\u00c3\3\2\2\2\u00d2" + "\u00c6\3\2\2\2\u00d2\u00c8\3\2\2\2\u00d2\u00ca\3\2\2\2\u00d2\u00cc\3\2" + "\2\2\u00d2\u00cd\3\2\2\2\u00d2\u00ce\3\2\2\2\u00d3\u0107\3\2\2\2\u00d4" + "\u00d5\f\20\2\2\u00d5\u00d6\t\5\2\2\u00d6\u0106\5&\24\21\u00d7\u00d8\f" + "\17\2\2\u00d8\u00d9\t\3\2\2\u00d9\u0106\5&\24\20\u00da\u00db\f\16\2\2" + "\u00db\u00dc\t\6\2\2\u00dc\u0106\5&\24\17\u00dd\u00de\f\r\2\2\u00de\u00df" + "\t\7\2\2\u00df\u0106\5&\24\16\u00e0\u00e1\f\f\2\2\u00e1\u00e2\t\b\2\2" + "\u00e2\u0106\5&\24\r\u00e3\u00e4\f\13\2\2\u00e4\u00e5\7#\2\2\u00e5\u0106" + "\5&\24\f\u00e6\u00e7\f\n\2\2\u00e7\u00e8\7\"\2\2\u00e8\u0106\5&\24\13" + "\u00e9\u00ea\f\t\2\2\u00ea\u00eb\7!\2\2\u00eb\u0106\5&\24\n\u00ec\u00ed" + "\f\b\2\2\u00ed\u00ee\7\33\2\2\u00ee\u0106\5&\24\t\u00ef\u00f0\f\7\2\2" + "\u00f0\u00f1\7\34\2\2\u00f1\u0106\5&\24\b\u00f2\u00f3\f\6\2\2\u00f3\u00f4" + "\7$\2\2\u00f4\u0106\5&\24\6\u00f5\u00f6\f\30\2\2\u00f6\u0106\t\2\2\2\u00f7" + "\u00f8\f\27\2\2\u00f8\u00fa\7*\2\2\u00f9\u00fb\5(\25\2\u00fa\u00f9\3\2" + "\2\2\u00fa\u00fb\3\2\2\2\u00fb\u00fc\3\2\2\2\u00fc\u0106\7+\2\2\u00fd" + "\u00fe\f\26\2\2\u00fe\u00ff\7,\2\2\u00ff\u0100\5&\24\2\u0100\u0101\7-" + "\2\2\u0101\u0106\3\2\2\2\u0102\u0103\f\25\2\2\u0103\u0104\7)\2\2\u0104" + "\u0106\7\64\2\2\u0105\u00d4\3\2\2\2\u0105\u00d7\3\2\2\2\u0105\u00da\3" + "\2\2\2\u0105\u00dd\3\2\2\2\u0105\u00e0\3\2\2\2\u0105\u00e3\3\2\2\2\u0105" + "\u00e6\3\2\2\2\u0105\u00e9\3\2\2\2\u0105\u00ec\3\2\2\2\u0105\u00ef\3\2" + "\2\2\u0105\u00f2\3\2\2\2\u0105\u00f5\3\2\2\2\u0105\u00f7\3\2\2\2\u0105" + "\u00fd\3\2\2\2\u0105\u0102\3\2\2\2\u0106\u0109\3\2\2\2\u0107\u0105\3\2" + "\2\2\u0107\u0108\3\2\2\2\u0108\'\3\2\2\2\u0109\u0107\3\2\2\2\u010a\u010b" + "\5&\24\2\u010b\u010c\7(\2\2\u010c\u010e\3\2\2\2\u010d\u010a\3\2\2\2\u010e" + "\u0111\3\2\2\2\u010f\u010d\3\2\2\2\u010f\u0110\3\2\2\2\u0110\u0112\3\2" + "\2\2\u0111\u010f\3\2\2\2\u0112\u0113\5&\24\2\u0113)\3\2\2\2\u0114\u0119" + "\5$\23\2\u0115\u0116\7,\2\2\u0116\u0117\5&\24\2\u0117\u0118\7-\2\2\u0118" + "\u011a\3\2\2\2\u0119\u0115\3\2\2\2\u011a\u011b\3\2\2\2\u011b\u0119\3\2" + "\2\2\u011b\u011c\3\2\2\2\u011c\u011e\3\2\2\2\u011d\u011f\5,\27\2\u011e" + "\u011d\3\2\2\2\u011f\u0120\3\2\2\2\u0120\u011e\3\2\2\2\u0120\u0121\3\2" + "\2\2\u0121\u0126\3\2\2\2\u0122\u0123\7,\2\2\u0123\u0124\5&\24\2\u0124" + "\u0125\7-\2\2\u0125\u0127\3\2\2\2\u0126\u0122\3\2\2\2\u0127\u0128\3\2" + "\2\2\u0128\u0126\3\2\2\2\u0128\u0129\3\2\2\2\u0129\u0142\3\2\2\2\u012a" + "\u012f\5$\23\2\u012b\u012c\7,\2\2\u012c\u012d\5&\24\2\u012d\u012e\7-\2" + "\2\u012e\u0130\3\2\2\2\u012f\u012b\3\2\2\2\u0130\u0131\3\2\2\2\u0131\u012f" + "\3\2\2\2\u0131\u0132\3\2\2\2\u0132\u0136\3\2\2\2\u0133\u0135\5,\27\2\u0134" + "\u0133\3\2\2\2\u0135\u0138\3\2\2\2\u0136\u0134\3\2\2\2\u0136\u0137\3\2" + "\2\2\u0137\u0142\3\2\2\2\u0138\u0136\3\2\2\2\u0139\u013f\5$\23\2\u013a" + "\u013c\7*\2\2\u013b\u013d\5(\25\2\u013c\u013b\3\2\2\2\u013c\u013d\3\2" + "\2\2\u013d\u013e\3\2\2\2\u013e\u0140\7+\2\2\u013f\u013a\3\2\2\2\u013f" + "\u0140\3\2\2\2\u0140\u0142\3\2\2\2\u0141\u0114\3\2\2\2\u0141\u012a\3\2" + "\2\2\u0141\u0139\3\2\2\2\u0142+\3\2\2\2\u0143\u0144\7,\2\2\u0144\u0145" + "\7-\2\2\u0145-\3\2\2\2\u0146\u014b\7\60\2\2\u0147\u014b\7\61\2\2\u0148" + "\u014b\7\62\2\2\u0149\u014b\7\63\2\2\u014a\u0146\3\2\2\2\u014a\u0147\3" + "\2\2\2\u014a\u0148\3\2\2\2\u014a\u0149\3\2\2\2\u014b/\3\2\2\2$\63;ENX" + "ain|\u0082\u008e\u0093\u0097\u009b\u00a5\u00a9\u00b0\u00b4\u00ba\u00c1" + "\u00d2\u00fa\u0105\u0107\u010f\u011b\u0120\u0128\u0131\u0136\u013c\u013f" + "\u0141\u014a"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
guanlichang/novel
src/main/java/org/yidu/novel/filter/GzipFilter.java
<gh_stars>0 package org.yidu.novel.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.yidu.novel.constant.YiDuConfig; import org.yidu.novel.constant.YiDuConstants; /** * * <p> * Gzip过滤器 * </p> * Copyright(c) 2014 YiDu-Novel. All rights reserved. * * @version 1.0.0 * @author shinpa.you */ public class GzipFilter implements Filter { /** * 过滤器配置 */ private FilterConfig filterConfig = null; /** * 构造方法 * * @return 过滤器配置 */ protected final FilterConfig getFilterConfig() { return this.filterConfig; } /** * {@inheritDoc} * * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) */ @Override public void init(final FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; } /** * {@inheritDoc} * * @see javax.servlet.Filter#destroy() */ @Override public void destroy() { this.filterConfig = null; } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { if (!YiDuConstants.yiduConf.getBoolean(YiDuConfig.GZIP_EFFECTIVE, false)) { chain.doFilter(req, res); } else { if (req instanceof HttpServletRequest) { if (!((HttpServletRequest) req).getRequestURI().startsWith("/download")) { // download以外的请求做Gzip处理 HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; String ae = request.getHeader("accept-encoding"); if (ae != null && ae.indexOf("gzip") != -1) { GZIPResponseWrapper wrappedResponse = new GZIPResponseWrapper(response); chain.doFilter(req, wrappedResponse); wrappedResponse.finishResponse(); return; } } } chain.doFilter(req, res); } } }
LarryHsiao/Clotho
src/main/java/com/larryhsiao/clotho/date/DateEndCalendar.java
<reponame>LarryHsiao/Clotho package com.larryhsiao.clotho.date; import com.larryhsiao.clotho.Source; import java.util.Calendar; /** * Source to generate Calendar which time is 23:59 of the given timestamp. */ public class DateEndCalendar implements Source<Calendar> { private final long millis; private final Calendar calendar; public DateEndCalendar(long millis) { this(millis, Calendar.getInstance()); } public DateEndCalendar(long millis, Calendar calendar) { this.millis = millis; this.calendar = calendar; } @Override public Calendar value() { calendar.setTimeInMillis(millis); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); return calendar; } }
sw402f19/Ardu3K
src/exception/factory/SemanticException.java
package exception.factory; public abstract class SemanticException extends RuntimeException { public SemanticException() { } public SemanticException(String message) { super(message); } public SemanticException(Throwable cause) { super(cause.getMessage(), cause); } }
jimmyblylee/XXMPS
src/apms-serv/src/main/java/com/founder/bj/apms/auxpolice/entity/AuxWork.java
/* *************************************************************************** * EZ.JWAF/EZ.JCWAP: Easy series Production. * Including JWAF(Java-based Web Application Framework) * and JCWAP(Java-based Customized Web Application Platform). * Copyright (C) 2016-2017 the original author or authors. * * This library is free software; you can redistribute it and/or * modify it under the terms of MIT License as published by * the Free Software Foundation; * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the MIT License for more details. * * You should have received a copy of the MIT License along * with this library; if not, write to the Free Software Foundation. * ***************************************************************************/ package com.founder.bj.apms.auxpolice.entity; import javax.persistence.*; import org.hibernate.annotations.GenericGenerator; import com.founder.bj.apms.sys.entity.SysUser; /** * Description: Aux Work Entity.<br> * Created by <NAME> on 2017/10/9. * * @author <NAME> */ @Entity @Table(name = "APMS_AUX_WORK") @SuppressWarnings("unused") public class AuxWork implements AuxStuff { private static final long serialVersionUID = 3938721311908893826L; /** Id. */ @Id @Column(name = "WORK_ID") @GeneratedValue(generator = "apms_uuid") @GenericGenerator(name = "apms_uuid", strategy = "uuid2") private String id; /** Work for department name. */ @Column(name = "WORK_DEPT") private String dept; /** Job title. */ @Column(name = "WORK_JOB") private String job; /** Start date. */ @OrderBy @Column(name = "WORK_START") private String start; /** End date. */ @Column(name = "WORK_END") private String end; /** 最近更新人ID与用户表关联. */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "LATEST_UPDATE_USER") private SysUser lastUpdateUser; /** 最近更新时间. */ @Column(name = "LATEST_UPDATE_DATE") private String lastUpdateDate; /** 最近更新IP. */ @Column(name = "LATEST_UPDATE_IP") private String lastUpdateIp; /** Aux. */ @ManyToOne @JoinColumn(name = "AUX_ID") private AuxInfo aux; /** * Get the id. * * @return return the id */ public String getId() { return id; } /** * Set id. * * @param id the id to set */ public void setId(String id) { this.id = id; } /** * Get the dept. * * @return return the dept */ public String getDept() { return dept; } /** * Set dept. * * @param dept the dept to set */ public void setDept(String dept) { this.dept = dept; } /** * Get the job. * * @return return the job */ public String getJob() { return job; } /** * Set job. * * @param job the job to set */ public void setJob(String job) { this.job = job; } /** * Get the start. * * @return return the start */ public String getStart() { return start; } /** * Set start. * * @param start the start to set */ public void setStart(String start) { this.start = start; } /** * Get the end. * * @return return the end */ public String getEnd() { return end; } /** * Set end. * * @param end the end to set */ public void setEnd(String end) { this.end = end; } /** * Get the lastUpdateUser. * * @return return the lastUpdateUser */ public SysUser getLastUpdateUser() { return lastUpdateUser; } /** * Set lastUpdateUser. * * @param lastUpdateUser the lastUpdateUser to set */ public void setLastUpdateUser(SysUser lastUpdateUser) { this.lastUpdateUser = lastUpdateUser; } /** * Get the lastUpdateDate. * * @return return the lastUpdateDate */ public String getLastUpdateDate() { return lastUpdateDate; } /** * Set lastUpdateDate. * * @param lastUpdateDate the lastUpdateDate to set */ public void setLastUpdateDate(String lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } /** * Get the lastUpdateIp. * * @return return the lastUpdateIp */ public String getLastUpdateIp() { return lastUpdateIp; } /** * Set lastUpdateIp. * * @param lastUpdateIp the lastUpdateIp to set */ public void setLastUpdateIp(String lastUpdateIp) { this.lastUpdateIp = lastUpdateIp; } /** * Get the aux. * * @return return the aux */ public AuxInfo getAux() { return aux; } /** * Set aux. * * @param aux the aux to set */ public void setAux(AuxInfo aux) { this.aux = aux; } }
ravikant7890/GoFFish_Giraph
giraph-block-app/src/main/java/org/apache/giraph/block_app/framework/piece/DefaultParentPiece.java
<reponame>ravikant7890/GoFFish_Giraph<gh_stars>1-10 /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.giraph.block_app.framework.piece; import org.apache.giraph.block_app.framework.api.BlockMasterApi; import org.apache.giraph.block_app.framework.api.BlockWorkerSendApi; import org.apache.giraph.block_app.framework.api.CreateReducersApi; import org.apache.giraph.block_app.framework.piece.global_comm.ReduceUtilsObject; import org.apache.giraph.block_app.framework.piece.global_comm.ReducerHandle; import org.apache.giraph.block_app.framework.piece.global_comm.internal.CreateReducersApiWrapper; import org.apache.giraph.block_app.framework.piece.global_comm.internal.ReducersForPieceHandler; import org.apache.giraph.block_app.framework.piece.interfaces.VertexPostprocessor; import org.apache.giraph.block_app.framework.piece.interfaces.VertexSender; import org.apache.giraph.block_app.framework.piece.messages.ObjectMessageClasses; import org.apache.giraph.block_app.framework.piece.messages.SupplierFromConf; import org.apache.giraph.block_app.framework.piece.messages.SupplierFromConf.DefaultMessageFactorySupplierFromConf; import org.apache.giraph.block_app.framework.piece.messages.SupplierFromConf.SupplierFromConfByCopy; import org.apache.giraph.combiner.MessageCombiner; import org.apache.giraph.comm.messages.MessageEncodeAndStoreType; import org.apache.giraph.conf.EnumConfOption; import org.apache.giraph.conf.GiraphConfigurationSettable; import org.apache.giraph.conf.GiraphConstants; import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration; import org.apache.giraph.conf.MessageClasses; import org.apache.giraph.factories.MessageValueFactory; import org.apache.giraph.graph.Vertex; import org.apache.giraph.types.NoMessage; import org.apache.hadoop.io.DoubleWritable; import org.apache.hadoop.io.FloatWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable; import com.google.common.base.Preconditions; /** * Additional abstract implementations for all pieces to be used. * Code here is not in AbstractPiece only to allow for non-standard * non-user-defined pieces. <br> * Only logic used by the underlying framework directly is in AbstractPiece * itself. * * @param <I> Vertex id type * @param <V> Vertex value type * @param <E> Edge value type * @param <M> Message type * @param <WV> Worker value type * @param <WM> Worker message type * @param <S> Execution stage type */ @SuppressWarnings({ "rawtypes", "unchecked" }) public abstract class DefaultParentPiece<I extends WritableComparable, V extends Writable, E extends Writable, M extends Writable, WV, WM extends Writable, S> extends AbstractPiece<I, V, E, M, WV, WM, S> { // TODO move to GiraphConstants /** * This option will tell which message encode & store enum to force, when * combining is not enabled. * * MESSAGE_ENCODE_AND_STORE_TYPE and this property are basically upper * and lower bound on message store type, when looking them in order from * not doing anything special, to most advanced type: * BYTEARRAY_PER_PARTITION, * EXTRACT_BYTEARRAY_PER_PARTITION, * POINTER_LIST_PER_VERTEX * resulting encode type is going to be: * pieceEncodingType = piece.allowOneMessageToManyIdsEncoding() ? * POINTER_LIST_PER_VERTEX : BYTEARRAY_PER_PARTITION) * Math.max(index(minForce), Math.min(index(maxAllowed), index(pieceType); * * This is useful to force all pieces onto particular message store, even * if they do not overrideallowOneMessageToManyIdsEncoding, though that might * be rarely needed. * This option might be more useful for fully local computation, * where overall job behavior is quite different. */ public static final EnumConfOption<MessageEncodeAndStoreType> MESSAGE_ENCODE_AND_STORE_TYPE_MIN_FORCE = EnumConfOption.create("giraph.messageEncodeAndStoreTypeMinForce", MessageEncodeAndStoreType.class, MessageEncodeAndStoreType.BYTEARRAY_PER_PARTITION, "Select the message_encode_and_store_type min force to use"); private final ReduceUtilsObject reduceUtils = new ReduceUtilsObject(); private ReducersForPieceHandler reducersHandler; // Overridable functions /** * Override to register any potential reducers used by this piece, * through calls to {@code reduceApi}, which will return reducer handles * for simple. * <br/> * Tip: Without defining a field, first write here name of the field and what * you want to reduce, like: * <br/> * {@code totalSum = reduceApi.createLocalReducer(SumReduce.DOUBLE); } * <br/> * and then use tools your IDE provides to generate field signature itself, * which might be slightly complex: * <br/> * {@code ReducerHandle<DoubleWritable, DoubleWritable> totalSum; } */ public void registerReducers(CreateReducersApi reduceApi, S executionStage) { } /** * Override to do vertex send processing. * * Creates handler that defines what should be executed on worker * during send phase. * * This logic gets executed first. * This function is called once on each worker on each thread, in parallel, * on their copy of Piece object to create functions handler. * * If returned object implements Postprocessor interface, then corresponding * postprocess() function is going to be called once, after all vertices * corresponding thread needed to process are done. */ public VertexSender<I, V, E> getVertexSender( BlockWorkerSendApi<I, V, E, M> workerApi, S executionStage) { return null; } /** * Override to specify type of the message this Piece sends, if it does * send messages. * * If not overwritten, no messages can be sent. */ protected Class<M> getMessageClass() { return null; } /** * Override to specify message value factory to be used, * which creates objects into which messages will be deserialized. * * If not overwritten, or null is returned, DefaultMessageValueFactory * will be used. */ protected MessageValueFactory<M> getMessageFactory( ImmutableClassesGiraphConfiguration conf) { return null; } /** * Override to specify message combiner to be used, if any. * * Message combiner itself should be immutable * (i.e. it will be call simultanously from multiple threads) */ protected MessageCombiner<? super I, M> getMessageCombiner( ImmutableClassesGiraphConfiguration conf) { return null; } /** * Override to specify that this Piece allows one to many ids encoding to be * used for messages. * You should override this function, if you are sending identical message to * all targets, and message itself is not extremely small. */ protected boolean allowOneMessageToManyIdsEncoding() { return false; } @Override public MessageClasses<I, M> getMessageClasses( ImmutableClassesGiraphConfiguration conf) { Class<M> messageClass = null; MessageValueFactory<M> messageFactory = getMessageFactory(conf); MessageCombiner<? super I, M> messageCombiner = getMessageCombiner(conf); if (messageFactory != null) { messageClass = (Class) messageFactory.newInstance().getClass(); } else if (messageCombiner != null) { messageClass = (Class) messageCombiner.createInitialMessage().getClass(); } if (messageClass != null) { Preconditions.checkState(getMessageClass() == null, "Piece %s defines getMessageFactory or getMessageCombiner, " + "so it doesn't need to define getMessageClass.", toString()); } else { messageClass = getMessageClass(); if (messageClass == null) { messageClass = (Class) NoMessage.class; } } SupplierFromConf<MessageValueFactory<M>> messageFactorySupplier; if (messageFactory != null) { messageFactorySupplier = new SupplierFromConfByCopy<MessageValueFactory<M>>(messageFactory); } else { messageFactorySupplier = new DefaultMessageFactorySupplierFromConf<>(messageClass); } SupplierFromConf<? extends MessageCombiner<? super I, M>> messageCombinerSupplier; if (messageCombiner != null) { messageCombinerSupplier = new SupplierFromConfByCopy<>(messageCombiner); } else { messageCombinerSupplier = null; } int maxAllowed = GiraphConstants.MESSAGE_ENCODE_AND_STORE_TYPE.get(conf).ordinal(); int minForce = MESSAGE_ENCODE_AND_STORE_TYPE_MIN_FORCE.get(conf).ordinal(); Preconditions.checkState(maxAllowed >= minForce); int pieceEncodeType = (allowOneMessageToManyIdsEncoding() ? MessageEncodeAndStoreType.POINTER_LIST_PER_VERTEX : MessageEncodeAndStoreType.BYTEARRAY_PER_PARTITION).ordinal(); // bound piece type with boundaries: pieceEncodeType = Math.max(minForce, Math.min(maxAllowed, pieceEncodeType)); MessageEncodeAndStoreType messageEncodeAndStoreType = MessageEncodeAndStoreType.values()[pieceEncodeType]; if (messageFactory instanceof GiraphConfigurationSettable) { throw new IllegalStateException( messageFactory.getClass() + " MessageFactory in " + this + " Piece implements GiraphConfigurationSettable"); } if (messageCombiner instanceof GiraphConfigurationSettable) { throw new IllegalStateException( messageCombiner.getClass() + " MessageCombiner in " + this + " Piece implements GiraphConfigurationSettable"); } return new ObjectMessageClasses<>( messageClass, messageFactorySupplier, messageCombinerSupplier, messageEncodeAndStoreType); } // Internal implementation @Override public final InnerVertexSender getWrappedVertexSender( final BlockWorkerSendApi<I, V, E, M> workerApi, S executionStage) { reducersHandler.vertexSenderWorkerPreprocess(workerApi); final VertexSender<I, V, E> functions = getVertexSender(workerApi, executionStage); return new InnerVertexSender() { @Override public void vertexSend(Vertex<I, V, E> vertex) { if (functions != null) { functions.vertexSend(vertex); } } @Override public void postprocess() { if (functions instanceof VertexPostprocessor) { ((VertexPostprocessor) functions).postprocess(); } reducersHandler.vertexSenderWorkerPostprocess(workerApi); } }; } @Override public final void wrappedRegisterReducers( BlockMasterApi masterApi, S executionStage) { reducersHandler = new ReducersForPieceHandler(); registerReducers(new CreateReducersApiWrapper( masterApi, reducersHandler), executionStage); } // utility functions: // TODO Java8 - move these as default functions to VertexSender interface protected final void reduceDouble( ReducerHandle<DoubleWritable, ?> reduceHandle, double value) { reduceUtils.reduceDouble(reduceHandle, value); } protected final void reduceFloat( ReducerHandle<FloatWritable, ?> reduceHandle, float value) { reduceUtils.reduceFloat(reduceHandle, value); } protected final void reduceLong( ReducerHandle<LongWritable, ?> reduceHandle, long value) { reduceUtils.reduceLong(reduceHandle, value); } protected final void reduceInt( ReducerHandle<IntWritable, ?> reduceHandle, int value) { reduceUtils.reduceInt(reduceHandle, value); } }
svendcsvendsen/judoassistant
src/ui/widgets/judoassistant_preferences_dialog.cpp
<reponame>svendcsvendsen/judoassistant<gh_stars>1-10 #include <QDialogButtonBox> #include <QVBoxLayout> #include <QHBoxLayout> #include <QStackedWidget> #include <QListWidget> #include <QTableView> #include "ui/widgets/judoassistant_preferences_dialog.hpp" #include "ui/widgets/web_connection_preferences_widget.hpp" #include "ui/widgets/save_preferences_widget.hpp" JudoassistantPreferencesDialog::JudoassistantPreferencesDialog(MasterStoreManager & storeManager, QWidget *parent) : QDialog(parent) , mStoreManager(storeManager) { QStackedWidget *stackedWidget = new QStackedWidget; QListWidget *listWidget = new QListWidget; listWidget->setMaximumWidth(150); // Add save preferences { QWidget *widget = new SavePreferencesWidget(storeManager); listWidget->addItem(tr("Tournament File Saving")); stackedWidget->addWidget(widget); } // Add web connection page { QWidget *widget = new WebConnectionPreferencesWidget(storeManager); listWidget->addItem(tr("Web Connection")); stackedWidget->addWidget(widget); } listWidget->setCurrentRow(0); stackedWidget->setCurrentIndex(0); connect(listWidget, &QListWidget::currentRowChanged, stackedWidget, &QStackedWidget::setCurrentIndex); // Setup layouts QVBoxLayout *mainLayout = new QVBoxLayout; QHBoxLayout *horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(listWidget); horizontalLayout->addWidget(stackedWidget); mainLayout->addLayout(horizontalLayout); // Setup button box { QDialogButtonBox *buttonBox = new QDialogButtonBox; buttonBox->addButton(tr("Close"), QDialogButtonBox::AcceptRole); mainLayout->addWidget(buttonBox); connect(buttonBox, &QDialogButtonBox::accepted, this, &JudoassistantPreferencesDialog::closeClick); } setLayout(mainLayout); setWindowTitle(tr("JudoAssistant Preferences")); setGeometry(geometry().x(), geometry().y(), 800, 400); } void JudoassistantPreferencesDialog::closeClick() { accept(); }
camshaft/postcss-runtime
src/compiler/process/color.js
import parser from 'postcss-values-parser'; import Color from 'color'; const colorMod = process.env.POSTCSS_RUNTIME_PATH || 'postcss-runtime'; /** * color: color(red shade(20%)); */ export default function plugin(root, compilation) { root.walkDecls((rule) => { const value = rule.value; if (!value) return; value.walk((node) => { if (node.type === 'func' && (node.value === 'color' || node.value === 'color-mod')) { parseColor(node, compilation); } }); }); } function parseColor(fun, compilation) { fun.value = compilation.import(colorMod, 'applyColorMods'); fun.unquote = true; const args = cleanArgs(fun); fun.removeAll(); args.forEach((arg, i) => { if (i === 0) { const value = color(arg, compilation); if (!value) { throw new Error(`Invalid color value: ${String(arg)}`); } fun.append(value); return; } const value = adjusters(arg, compilation); if (value) { fun.append(value); return; } // TODO use postcss warnings console.error(`Invalid adjuster function: ${arg.toString()}`); return false; }); } const rgba = choice(['red', 'green', 'blue', 'alpha', 'a'], (value) => { return value === 'a' ? 'alpha' : value; }); const hue = choice(['hue', 'h'], () => 'hue'); const saturation = choice(['saturation', 's'], () => 'saturation'); const lightness = choice(['lightness', 's'], () => 'lightness'); const whiteness = choice(['whiteness', 's'], () => 'whiteness'); const blackness = choice(['blackness', 's'], () => 'blackness'); const rgb = toCombinator('rgb'); const PLUS = operator('+'); const MINUS = operator('-'); const MULT = operator('*'); const colorSpaces = choice(['rgb', 'hsl', 'hwb']); const ops = { '+': 'add', '-': 'sub', '*': 'mult', }; const number = numberComb('parseNumber', '', (node, compilation) => { node.unquote = true; }); const percentage = numberComb('parsePercentage', '%', (node, compilation) => { return callNumberFunction(node, compilation, 'percentage'); }); const angle = numberComb('parseAngle', ['', 'deg', 'grad', 'rad', 'turn'], (node, compilation) => { const unit = node.unit || 'deg'; return callNumberFunction(node, compilation, unit); }); const adjusters = choice([ func(rgba, [ option(choice([PLUS, MINUS, MULT])), choice([number, percentage]), ], (node, compilation, args) => { let name = node.value; const op = args[0]; if (op) { op.value = compilation.import(colorMod, ops[op.value]); op.unquote = true; } else { args[0] = parser.word({ value: compilation.import(colorMod, 'set'), unquote: true, }); } node.value = compilation.import(colorMod, name); node.unquote = true; node.nodes = args; }), func(rgb, [ choice([PLUS, MINUS]), option(choice([number, percentage])), option(choice([number, percentage])), option(choice([number, percentage])), ], (node, compilation, args) => { let name = node.value; const op = args[0]; op.value = compilation.import(colorMod, ops[op.value]); op.unquote = true; node.value = compilation.import(colorMod, name); node.unquote = true; node.nodes = args; }), func(rgb, [ choice([PLUS, MINUS]), // hashToken, // TODO ], (node, compilation, args) => { // TODO }), func(rgb, [ MULT, percentage ], (node, compilation, args) => { const name = node.value + 'Mult'; node.value = compilation.import(colorMod, name); node.unquote = true; node.nodes = args.slice(1); }), func(hue, [ option(choice([PLUS, MINUS, MULT])), angle, ], hsl), func(saturation, [ option(choice([PLUS, MINUS, MULT])), option(choice([number, percentage])), ], hsl), func(lightness, [ option(choice([PLUS, MINUS, MULT])), option(choice([number, percentage])), ], hsl), func(whiteness, [ option(choice([PLUS, MINUS, MULT])), option(choice([number, percentage])), ], hsl), func(blackness, [ option(choice([PLUS, MINUS, MULT])), option(choice([number, percentage])), ], hsl), func('tint', [ percentage, ], tintShade), func('shade', [ percentage, ], tintShade), func('blend', [ color, percentage, option(colorSpaces), ], blend), func('blenda', [ color, percentage, option(colorSpaces), ], blend), func('contrast', [ option(percentage), ], contrast), ]); function cleanArgs(fun) { const args = []; fun.each((arg, i) => { const type = arg.type; if (type === 'string') { throw new Error(`Invalid color-mod argument: ${String(arg)}`); } if (type === 'func' || type === 'number' || type === 'operator' || type === 'word') return args.push(arg.clone()); }); return args; } function isVariable(node) { return node && node.type === 'function' && node.value === 'var'; } function toCombinator(value) { if (typeof value === 'function') return value; return (v) => v === value && value; } function choice(choices, transform = (v) => v) { choices = choices.map(toCombinator); return (value, compilation) => { for (let i = 0; i < choices.length; i++) { const res = choices[i](value, compilation); if (res) return (transform(res, compilation) || res); } return false; }; } function word(name) { return (node) => { return node.type === 'word' && node.value === name && node; }; } function operator(name) { return (node) => { return node.type === 'operator' && node.value === name && node; }; } function func(name, argMatchers, transform = v => v) { name = toCombinator(name); argMatchers = argMatchers.map(toCombinator); return (node, compilation) => { if (!node || node.type !== 'func') return false; const value = name(node.value, compilation); if (!value) return false; node.value = value; const args = cleanArgs(node); let j = 0; const out = []; for (let i = 0; i < argMatchers.length; i++) { let res = argMatchers[i](args[j], compilation); if (!res) return false; if (res === option) { res = undefined; } else { j++; } out[i] = res; } node.removeAll(); out.forEach(arg => arg && node.append(arg)); return (transform(node, compilation, out) || node); }; } function option(fun) { return (node, compilation) => { if (!node) return option; const value = fun(node, compilation); if (!value) return option; return value; }; } function color(node, compilation) { const type = node.type; const value = node.value; if (type === 'func') { switch(value) { case 'color': case 'color-mod': return node; case 'var': return callNumberFunction(node, compilation, 'applyColorMods', false); case 'rgb': case 'rgba': case 'hsl': case 'hsla': case 'hsv': case 'hwb': case 'hcg': case 'cmyk': case 'xyz': case 'lab': // TODO convert into color([a, b, c], model) return callNumberFunction(node, compilation, 'applyColorMods', false); default: return false; } } if (type === 'word') { if (value === 'currentColor') return false; try { new Color(value); } catch (e) { return false; } return callNumberFunction(node, compilation, 'applyColorMods', false); } return false; } function callNumberFunction(node, compilation, name, unquote = true) { const call = parser.func({ unquote: true, value: compilation.import(colorMod, name), source: node.source, sourceIndex: node.sourceIndex, }); call.append(node.clone({ unquote: unquote, unit: '', })); return call; } function numberComb(parser, unit = '', transform = v => v) { if (!Array.isArray(unit)) unit = [unit] return (node, compilation) => { if (isVariable(node)) { return callNumberFunction(node, compilation, parser); } return node && node.type === 'number' && ~unit.indexOf(node.unit) && (transform(node, compilation) || node); }; } function hsl(node, compilation, args) { let name = node.value; const op = args[0]; if (op) { op.value = compilation.import(colorMod, ops[op.value]); op.unquote = true; } else { args[0] = parser.word({ value: compilation.import(colorMod, 'set'), unquote: true, }); } node.value = compilation.import(colorMod, name); node.unquote = true; node.nodes = args; }; function tintShade(node, compilation, args) { node.value = compilation.import(colorMod, node.value); node.unquote = true; } function blend(node, compilation, args) { node.value = compilation.import(colorMod, node.value); node.unquote = true; } function contrast(node, compilation, args) { node.value = compilation.import(colorMod, node.value); node.unquote = true; }
bangchuanliu/algorithm-examples
leetcode/src/main/java/common/QuickSort.java
package common; public class QuickSort { public void sort(int[] A) { if (A == null || A.length == 0) { return; } qSort(A, 0, A.length - 1); } public int partition(int[] A, int low, int high) { int r = A[high]; int i = low - 1; int j = low; while (j < high) { if (A[j] <= r) { i++; swap(A, i, j); } j++; } i++; swap(A, i, high); return i; } public void swap(int[] A, int i, int j) { int temp = A[i]; A[i] = A[j]; A[j] = temp; } public void qSort(int[] A, int low, int high) { if (low < high) { int r = partition(A, low, high); qSort(A, low, r - 1); qSort(A, r + 1, high); } } public static void main(String[] args){ int[] A= {1,3,5,9,2,4,1,5,7}; new QuickSort().sort(A); for(int a : A){ System.out.print(a + " "); } } }
maddy-torqata/gokul-organics1
node_modules/@fortawesome/pro-solid-svg-icons/faMistletoe.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var prefix = 'fas'; var iconName = 'mistletoe'; var width = 576; var height = 512; var ligatures = []; var unicode = 'f7b4'; var svgPathData = 'M373.3 117.3c23.6 0 42.7-19.1 42.7-42.7S396.9 32 373.3 32s-42.7 19.1-42.7 42.7 19.2 42.6 42.7 42.6zm168.8 144.1c-26-26-89.6-38.6-130.9-44.2L312 117.1c-8.4-12.1-13.3-26.6-13.3-42.4s5-30.3 13.3-42.4V16c0-8.8-7.2-16-16-16h-16c-8.8 0-16 7.2-16 16v102.1l-99.1 99.1C123.6 222.8 60 235.4 34 261.4c-40 40-45.4 99.4-12.1 132.7 33.3 33.3 92.8 27.9 132.7-12.1 11.4-11.4 20.1-30.2 26.9-51 6.8 12.3 19.5 20.9 34.5 20.9 22.1 0 40-17.9 40-40s-17.9-40-40-40c-8.2 0-15.4 3.1-21.7 7.3 1.8-10 3.4-19.6 4.5-28.2l65.2-65.2v72.8c14.6 13.2 24 32.1 24 53.3 0 39.7-32.3 72-72 72-6.2 0-12.1-1-17.8-2.5-3.7 9.9-6.2 19.5-6.2 28.1 0 56.6 43 102.4 96 102.4s96-45.8 96-102.4c0-38.1-43.6-94.6-72-127.3v-96.3l65.2 65.2c5.6 41.3 18.2 104.9 44.2 130.9 40 40 99.4 45.4 132.7 12.1 33.4-33.3 28-92.7-12-132.7z'; exports.definition = { prefix: prefix, iconName: iconName, icon: [ width, height, ligatures, unicode, svgPathData ]}; exports.faMistletoe = exports.definition; exports.prefix = prefix; exports.iconName = iconName; exports.width = width; exports.height = height; exports.ligatures = ligatures; exports.unicode = unicode; exports.svgPathData = svgPathData;
gatordevin/BoofCV
main/boofcv-recognition/src/main/java/boofcv/deepboof/BaseImageClassifier.java
/* * Copyright (c) 2020, <NAME>. All Rights Reserved. * * This file is part of BoofCV (http://boofcv.org). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package boofcv.deepboof; import boofcv.abst.scene.ImageClassifier; import boofcv.struct.image.GrayF32; import boofcv.struct.image.ImageType; import boofcv.struct.image.Planar; import deepboof.Function; import deepboof.graph.FunctionSequence; import deepboof.tensors.Tensor_F32; import org.ddogleg.struct.DogArray; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Base class for ImageClassifiers which implements common elements * * @author <NAME> */ public abstract class BaseImageClassifier implements ImageClassifier<Planar<GrayF32>> { protected FunctionSequence<Tensor_F32, Function<Tensor_F32>> network; // List of all the categories protected List<String> categories = new ArrayList<>(); protected ImageType<Planar<GrayF32>> imageType = ImageType.pl(3, GrayF32.class); // Resizes input image for the network protected ClipAndReduce<Planar<GrayF32>> massage = new ClipAndReduce<>(true, imageType); // size of square image protected int imageSize; // Input image adjusted to network input size protected Planar<GrayF32> imageRgb; // Storage for the tensor into the image protected Tensor_F32 tensorInput; protected Tensor_F32 tensorOutput; // storage for the final output protected DogArray<Score> categoryScores = new DogArray<>(Score::new); protected int categoryBest; Comparator<Score> comparator = ( o1, o2 ) -> { if (o1.score < o2.score) return 1; else if (o1.score > o2.score) return -1; else return 0; }; protected BaseImageClassifier( int imageSize ) { this.imageSize = imageSize; imageRgb = new Planar<>(GrayF32.class, imageSize, imageSize, 3); tensorInput = new Tensor_F32(1, 3, imageSize, imageSize); } @Override public ImageType<Planar<GrayF32>> getInputType() { return imageType; } /** * The original implementation takes in an image then crops it randomly. This is primarily for training but is * replicated here to reduce the number of differences * * @param image Image being processed. Must be RGB image. Pixel values must have values from 0 to 255. */ @Override public void classify( Planar<GrayF32> image ) { DataManipulationOps.imageToTensor(preprocess(image), tensorInput, 0); innerProcess(tensorInput); } /** * Massage the input image into a format recognized by the network */ protected Planar<GrayF32> preprocess( Planar<GrayF32> image ) { // Shrink the image to input size if (image.width == imageSize && image.height == imageSize) { this.imageRgb.setTo(image); } else if (image.width < imageSize || image.height < imageSize) { throw new IllegalArgumentException("Image width or height is too small"); } else { massage.massage(image, imageRgb); } return imageRgb; } protected void innerProcess( Tensor_F32 tensorInput ) { // process the tensor network.process(tensorInput, tensorOutput); // now find the best score and sort them categoryScores.reset(); double scoreBest = -Double.MAX_VALUE; categoryBest = -1; for (int category = 0; category < tensorOutput.length(1); category++) { double score = tensorOutput.get(0, category); categoryScores.grow().set(score, category); if (score > scoreBest) { scoreBest = score; categoryBest = category; } } // order the categories by most to least likely Collections.sort(categoryScores.toList(), comparator); } @Override public int getBestResult() { return categoryBest; } @Override public List<Score> getAllResults() { return categoryScores.toList(); } @Override public List<String> getCategories() { return categories; } public Planar<GrayF32> getImageRgb() { return imageRgb; } }
darkma773r/commons-numbers
commons-numbers-gamma/src/test/java/org/apache/commons/numbers/gamma/LogBetaTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.numbers.gamma; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** * Tests for {@link LogBeta}. */ class LogBetaTest { private static final double[][] LOG_BETA_REF = { {0.125, 0.125, 2.750814190409515}, {0.125, 0.25, 2.444366899981226}, {0.125, 0.5, 2.230953804989556}, {0.125, 1.0, 2.079441541679836}, {0.125, 2.0, 1.961658506023452}, {0.125, 3.0, 1.901033884207018}, {0.125, 4.0, 1.860211889686763}, {0.125, 5.0, 1.829440231020009}, {0.125, 6.0, 1.804747618429637}, {0.125, 7.0, 1.784128331226902}, {0.125, 8.0, 1.766428754127501}, {0.125, 9.0, 1.750924567591535}, {0.125, 10.0, 1.7371312454592}, {0.125, 1000.0, 1.156003642015969}, {0.125, 1001.0, 1.155878649827818}, {0.125, 10000.0, .8681312798751318}, {0.25, 0.125, 2.444366899981226}, {0.25, 0.25, 2.003680106471455}, {0.25, 0.5, 1.657106516191482}, {0.25, 1.0, 1.386294361119891}, {0.25, 2.0, 1.163150809805681}, {0.25, 3.0, 1.045367774149297}, {0.25, 4.0, 0.965325066475761}, {0.25, 5.0, .9047004446593261}, {0.25, 6.0, .8559102804898941}, {0.25, 7.0, 0.815088285969639}, {0.25, 8.0, .7799969661583689}, {0.25, 9.0, .7492253074916152}, {0.25, 10.0, .7218263333035008}, {0.25, 1000.0, -.4388225372378877}, {0.25, 1001.0, -.4390725059930951}, {0.25, 10000.0, -1.014553193217846}, {0.5, 0.125, 2.230953804989556}, {0.5, 0.25, 1.657106516191482}, {0.5, 0.5, 1.1447298858494}, {0.5, 1.0, .6931471805599453}, {0.5, 2.0, .2876820724517809}, {0.5, 3.0, .06453852113757118}, // {0.5, 4.0, -.08961215868968714}, {0.5, 5.0, -.2073951943460706}, {0.5, 6.0, -.3027053741503954}, {0.5, 7.0, -.3827480818239319}, {0.5, 8.0, -.4517409533108833}, {0.5, 9.0, -.5123655751273182}, {0.5, 10.0, -.5664327963975939}, {0.5, 1000.0, -2.881387696571577}, {0.5, 1001.0, -2.881887571613228}, {0.5, 10000.0, -4.032792743063396}, {1.0, 0.125, 2.079441541679836}, {1.0, 0.25, 1.386294361119891}, {1.0, 0.5, .6931471805599453}, {1.0, 1.0, 0.0}, {1.0, 2.0, -.6931471805599453}, {1.0, 3.0, -1.09861228866811}, {1.0, 4.0, -1.386294361119891}, {1.0, 5.0, -1.6094379124341}, {1.0, 6.0, -1.791759469228055}, {1.0, 7.0, -1.945910149055313}, {1.0, 8.0, -2.079441541679836}, {1.0, 9.0, -2.19722457733622}, {1.0, 10.0, -2.302585092994046}, {1.0, 1000.0, -6.907755278982137}, {1.0, 1001.0, -6.90875477931522}, {1.0, 10000.0, -9.210340371976184}, {2.0, 0.125, 1.961658506023452}, {2.0, 0.25, 1.163150809805681}, {2.0, 0.5, .2876820724517809}, {2.0, 1.0, -.6931471805599453}, {2.0, 2.0, -1.791759469228055}, {2.0, 3.0, -2.484906649788}, {2.0, 4.0, -2.995732273553991}, {2.0, 5.0, -3.401197381662155}, {2.0, 6.0, -3.737669618283368}, {2.0, 7.0, -4.02535169073515}, {2.0, 8.0, -4.276666119016055}, {2.0, 9.0, -4.499809670330265}, {2.0, 10.0, -4.700480365792417}, {2.0, 1000.0, -13.81651005829736}, {2.0, 1001.0, -13.81850806096003}, {2.0, 10000.0, -18.4207807389527}, {3.0, 0.125, 1.901033884207018}, {3.0, 0.25, 1.045367774149297}, {3.0, 0.5, .06453852113757118}, {3.0, 1.0, -1.09861228866811}, {3.0, 2.0, -2.484906649788}, {3.0, 3.0, -3.401197381662155}, {3.0, 4.0, -4.0943445622221}, {3.0, 5.0, -4.653960350157523}, {3.0, 6.0, -5.123963979403259}, {3.0, 7.0, -5.529429087511423}, {3.0, 8.0, -5.886104031450156}, {3.0, 9.0, -6.20455776256869}, {3.0, 10.0, -6.492239835020471}, {3.0, 1000.0, -20.03311615938222}, {3.0, 1001.0, -20.03611166836202}, {3.0, 10000.0, -26.9381739103716}, {4.0, 0.125, 1.860211889686763}, {4.0, 0.25, 0.965325066475761}, // {4.0, 0.5, -.08961215868968714}, {4.0, 1.0, -1.386294361119891}, {4.0, 2.0, -2.995732273553991}, {4.0, 3.0, -4.0943445622221}, {4.0, 4.0, -4.941642422609304}, {4.0, 5.0, -5.634789603169249}, {4.0, 6.0, -6.222576268071369}, {4.0, 7.0, -6.733401891837359}, {4.0, 8.0, -7.185387015580416}, {4.0, 9.0, -7.590852123688581}, {4.0, 10.0, -7.958576903813898}, {4.0, 1000.0, -25.84525465867605}, {4.0, 1001.0, -25.84924667994559}, {4.0, 10000.0, -35.05020194868867}, {5.0, 0.125, 1.829440231020009}, {5.0, 0.25, .9047004446593261}, {5.0, 0.5, -.2073951943460706}, {5.0, 1.0, -1.6094379124341}, {5.0, 2.0, -3.401197381662155}, {5.0, 3.0, -4.653960350157523}, {5.0, 4.0, -5.634789603169249}, {5.0, 5.0, -6.445719819385578}, {5.0, 6.0, -7.138866999945524}, {5.0, 7.0, -7.745002803515839}, {5.0, 8.0, -8.283999304248526}, {5.0, 9.0, -8.769507120030227}, {5.0, 10.0, -9.211339872309265}, {5.0, 1000.0, -31.37070759780783}, {5.0, 1001.0, -31.37569513931887}, {5.0, 10000.0, -42.87464787956629}, {6.0, 0.125, 1.804747618429637}, {6.0, 0.25, .8559102804898941}, {6.0, 0.5, -.3027053741503954}, {6.0, 1.0, -1.791759469228055}, {6.0, 2.0, -3.737669618283368}, {6.0, 3.0, -5.123963979403259}, {6.0, 4.0, -6.222576268071369}, {6.0, 5.0, -7.138866999945524}, {6.0, 6.0, -7.927324360309794}, {6.0, 7.0, -8.620471540869739}, {6.0, 8.0, -9.239510749275963}, {6.0, 9.0, -9.799126537211386}, {6.0, 10.0, -10.30995216097738}, {6.0, 1000.0, -36.67401250586691}, {6.0, 1001.0, -36.67999457754446}, {6.0, 10000.0, -50.47605021415003}, {7.0, 0.125, 1.784128331226902}, {7.0, 0.25, 0.815088285969639}, {7.0, 0.5, -.3827480818239319}, {7.0, 1.0, -1.945910149055313}, {7.0, 2.0, -4.02535169073515}, {7.0, 3.0, -5.529429087511423}, {7.0, 4.0, -6.733401891837359}, {7.0, 5.0, -7.745002803515839}, {7.0, 6.0, -8.620471540869739}, {7.0, 7.0, -9.39366142910322}, {7.0, 8.0, -10.08680860966317}, {7.0, 9.0, -10.71541726908554}, {7.0, 10.0, -11.2907814139891}, {7.0, 1000.0, -41.79599038729854}, {7.0, 1001.0, -41.80296600103496}, {7.0, 10000.0, -57.89523093697012}, {8.0, 0.125, 1.766428754127501}, {8.0, 0.25, .7799969661583689}, {8.0, 0.5, -.4517409533108833}, {8.0, 1.0, -2.079441541679836}, {8.0, 2.0, -4.276666119016055}, {8.0, 3.0, -5.886104031450156}, {8.0, 4.0, -7.185387015580416}, {8.0, 5.0, -8.283999304248526}, {8.0, 6.0, -9.239510749275963}, {8.0, 7.0, -10.08680860966317}, {8.0, 8.0, -10.84894866171006}, {8.0, 9.0, -11.54209584227001}, {8.0, 10.0, -12.17808460899001}, {8.0, 1000.0, -46.76481113096179}, {8.0, 1001.0, -46.77277930061096}, {8.0, 10000.0, -65.16036091500527}, {9.0, 0.125, 1.750924567591535}, {9.0, 0.25, .7492253074916152}, {9.0, 0.5, -.5123655751273182}, {9.0, 1.0, -2.19722457733622}, {9.0, 2.0, -4.499809670330265}, {9.0, 3.0, -6.20455776256869}, {9.0, 4.0, -7.590852123688581}, {9.0, 5.0, -8.769507120030227}, {9.0, 6.0, -9.799126537211386}, {9.0, 7.0, -10.71541726908554}, {9.0, 8.0, -11.54209584227001}, {9.0, 9.0, -12.29586764464639}, {9.0, 10.0, -12.98901482520633}, {9.0, 1000.0, -51.60109303791327}, {9.0, 1001.0, -51.61005277928474}, {9.0, 10000.0, -72.29205942547217}, {10.0, 0.125, 1.7371312454592}, {10.0, 0.25, .7218263333035008}, {10.0, 0.5, -.5664327963975939}, {10.0, 1.0, -2.302585092994046}, {10.0, 2.0, -4.700480365792417}, {10.0, 3.0, -6.492239835020471}, {10.0, 4.0, -7.958576903813898}, {10.0, 5.0, -9.211339872309265}, {10.0, 6.0, -10.30995216097738}, {10.0, 7.0, -11.2907814139891}, {10.0, 8.0, -12.17808460899001}, {10.0, 9.0, -12.98901482520633}, {10.0, 10.0, -13.73622922703655}, {10.0, 1000.0, -56.32058348093065}, {10.0, 1001.0, -56.33053381178382}, {10.0, 10000.0, -79.30607481535498}, {1000.0, 0.125, 1.156003642015969}, {1000.0, 0.25, -.4388225372378877}, {1000.0, 0.5, -2.881387696571577}, {1000.0, 1.0, -6.907755278982137}, {1000.0, 2.0, -13.81651005829736}, {1000.0, 3.0, -20.03311615938222}, {1000.0, 4.0, -25.84525465867605}, {1000.0, 5.0, -31.37070759780783}, {1000.0, 6.0, -36.67401250586691}, {1000.0, 7.0, -41.79599038729854}, {1000.0, 8.0, -46.76481113096179}, {1000.0, 9.0, -51.60109303791327}, {1000.0, 10.0, -56.32058348093065}, {1000.0, 1000.0, -1388.482601635902}, {1000.0, 1001.0, -1389.175748816462}, {1000.0, 10000.0, -3353.484270767097}, {1001.0, 0.125, 1.155878649827818}, {1001.0, 0.25, -.4390725059930951}, {1001.0, 0.5, -2.881887571613228}, {1001.0, 1.0, -6.90875477931522}, {1001.0, 2.0, -13.81850806096003}, {1001.0, 3.0, -20.03611166836202}, {1001.0, 4.0, -25.84924667994559}, {1001.0, 5.0, -31.37569513931887}, {1001.0, 6.0, -36.67999457754446}, {1001.0, 7.0, -41.80296600103496}, {1001.0, 8.0, -46.77277930061096}, {1001.0, 9.0, -51.61005277928474}, {1001.0, 10.0, -56.33053381178382}, {1001.0, 1000.0, -1389.175748816462}, {1001.0, 1001.0, -1389.869395872064}, {1001.0, 10000.0, -3355.882166039895}, {10000.0, 0.125, .8681312798751318}, {10000.0, 0.25, -1.014553193217846}, {10000.0, 0.5, -4.032792743063396}, {10000.0, 1.0, -9.210340371976184}, {10000.0, 2.0, -18.4207807389527}, {10000.0, 3.0, -26.9381739103716}, {10000.0, 4.0, -35.05020194868867}, {10000.0, 5.0, -42.87464787956629}, {10000.0, 6.0, -50.47605021415003}, {10000.0, 7.0, -57.89523093697012}, {10000.0, 8.0, -65.16036091500527}, {10000.0, 9.0, -72.29205942547217}, {10000.0, 10.0, -79.30607481535498}, {10000.0, 1000.0, -3353.484270767097}, {10000.0, 1001.0, -3355.882166039895}, {10000.0, 10000.0, -13866.28325676141}, }; private static final double[][] LOG_GAMMA_MINUS_LOG_GAMMA_SUM_REF = { // { 0.0 , 8.0 , 0.0 }, // { 0.0 , 9.0 , 0.0 }, {0.0, 10.0, 0.0}, {0.0, 11.0, 0.0}, {0.0, 12.0, 0.0}, {0.0, 13.0, 0.0}, {0.0, 14.0, 0.0}, {0.0, 15.0, 0.0}, {0.0, 16.0, 0.0}, {0.0, 17.0, 0.0}, {0.0, 18.0, 0.0}, // {1.0, 8.0, -2.079441541679836}, // {1.0, 9.0, -2.19722457733622}, {1.0, 10.0, -2.302585092994046}, {1.0, 11.0, -2.397895272798371}, {1.0, 12.0, -2.484906649788}, {1.0, 13.0, -2.564949357461537}, {1.0, 14.0, -2.639057329615258}, {1.0, 15.0, -2.70805020110221}, {1.0, 16.0, -2.772588722239781}, {1.0, 17.0, -2.833213344056216}, {1.0, 18.0, -2.890371757896165}, // {2.0, 8.0, -4.276666119016055}, // {2.0, 9.0, -4.499809670330265}, {2.0, 10.0, -4.700480365792417}, {2.0, 11.0, -4.882801922586371}, {2.0, 12.0, -5.049856007249537}, {2.0, 13.0, -5.204006687076795}, {2.0, 14.0, -5.347107530717468}, {2.0, 15.0, -5.480638923341991}, {2.0, 16.0, -5.605802066295998}, {2.0, 17.0, -5.723585101952381}, {2.0, 18.0, -5.834810737062605}, // {3.0, 8.0, -6.579251212010101}, // {3.0, 9.0, -6.897704943128636}, {3.0, 10.0, -7.185387015580416}, {3.0, 11.0, -7.447751280047908}, {3.0, 12.0, -7.688913336864796}, {3.0, 13.0, -7.912056888179006}, {3.0, 14.0, -8.11969625295725}, {3.0, 15.0, -8.313852267398207}, {3.0, 16.0, -8.496173824192162}, {3.0, 17.0, -8.668024081118821}, {3.0, 18.0, -8.830543010616596}, // {4.0, 8.0, -8.977146484808472}, // {4.0, 9.0, -9.382611592916636}, {4.0, 10.0, -9.750336373041954}, {4.0, 11.0, -10.08680860966317}, {4.0, 12.0, -10.39696353796701}, {4.0, 13.0, -10.68464561041879}, {4.0, 14.0, -10.95290959701347}, {4.0, 15.0, -11.20422402529437}, {4.0, 16.0, -11.4406128033586}, {4.0, 17.0, -11.66375635467281}, {4.0, 18.0, -11.87506544834002}, // {5.0, 8.0, -11.46205313459647}, // {5.0, 9.0, -11.94756095037817}, {5.0, 10.0, -12.38939370265721}, {5.0, 11.0, -12.79485881076538}, {5.0, 12.0, -13.16955226020679}, {5.0, 13.0, -13.517858954475}, {5.0, 14.0, -13.84328135490963}, {5.0, 15.0, -14.14866300446081}, {5.0, 16.0, -14.43634507691259}, {5.0, 17.0, -14.70827879239624}, {5.0, 18.0, -14.96610790169833}, // {6.0, 8.0, -14.02700249205801}, // {6.0, 9.0, -14.58661827999343}, {6.0, 10.0, -15.09744390375942}, {6.0, 11.0, -15.56744753300516}, {6.0, 12.0, -16.002765604263}, {6.0, 13.0, -16.40823071237117}, {6.0, 14.0, -16.78772033407607}, {6.0, 15.0, -17.14439527801481}, {6.0, 16.0, -17.48086751463602}, {6.0, 17.0, -17.79932124575455}, {6.0, 18.0, -18.10160211762749}, // {7.0, 8.0, -16.66605982167327}, // {7.0, 9.0, -17.29466848109564}, {7.0, 10.0, -17.8700326259992}, {7.0, 11.0, -18.40066087706137}, {7.0, 12.0, -18.89313736215917}, {7.0, 13.0, -19.35266969153761}, {7.0, 14.0, -19.78345260763006}, {7.0, 15.0, -20.18891771573823}, {7.0, 16.0, -20.57190996799433}, {7.0, 17.0, -20.9348154616837}, {7.0, 18.0, -21.27965594797543}, // {8.0, 8.0, -19.37411002277548}, // {8.0, 9.0, -20.06725720333542}, {8.0, 10.0, -20.70324597005542}, {8.0, 11.0, -21.29103263495754}, {8.0, 12.0, -21.83757634132561}, {8.0, 13.0, -22.3484019650916}, {8.0, 14.0, -22.82797504535349}, {8.0, 15.0, -23.27996016909654}, {8.0, 16.0, -23.70740418392348}, {8.0, 17.0, -24.11286929203165}, {8.0, 18.0, -24.49853177284363}, // {9.0, 8.0, -22.14669874501526}, // {9.0, 9.0, -22.90047054739164}, {9.0, 10.0, -23.59361772795159}, {9.0, 11.0, -24.23547161412398}, {9.0, 12.0, -24.8333086148796}, {9.0, 13.0, -25.39292440281502}, {9.0, 14.0, -25.9190174987118}, {9.0, 15.0, -26.41545438502569}, {9.0, 16.0, -26.88545801427143}, {9.0, 17.0, -27.33174511689985}, {9.0, 18.0, -27.75662831086511}, // {10.0, 8.0, -24.97991208907148}, // {10.0, 9.0, -25.7908423052878}, {10.0, 10.0, -26.53805670711802}, {10.0, 11.0, -27.23120388767797}, {10.0, 12.0, -27.87783105260302}, {10.0, 13.0, -28.48396685617334}, {10.0, 14.0, -29.05451171464095}, {10.0, 15.0, -29.59350821537364}, {10.0, 16.0, -30.10433383913963}, {10.0, 17.0, -30.58984165492133}, {10.0, 18.0, -31.05246517686944}, }; private static final double[][] SUM_DELTA_MINUS_DELTA_SUM_REF = { {10.0, 10.0, .01249480717472882}, {10.0, 11.0, .01193628470267385}, {10.0, 12.0, .01148578547212797}, {10.0, 13.0, .01111659739668398}, {10.0, 14.0, .01080991216314295}, {10.0, 15.0, .01055214134859758}, {10.0, 16.0, .01033324912491747}, {10.0, 17.0, .01014568069918883}, {10.0, 18.0, .009983653199146491}, {10.0, 19.0, .009842674320242729}, {10.0, 20.0, 0.0097192081956071}, {11.0, 10.0, .01193628470267385}, {11.0, 11.0, .01135973290745925}, {11.0, 12.0, .01089355537047828}, {11.0, 13.0, .01051064829297728}, {11.0, 14.0, 0.0101918899639826}, {11.0, 15.0, .009923438811859604}, {11.0, 16.0, .009695052724952705}, {11.0, 17.0, 0.00949900745283617}, {11.0, 18.0, .009329379874933402}, {11.0, 19.0, 0.00918156080743147}, {11.0, 20.0, 0.00905191635141762}, {12.0, 10.0, .01148578547212797}, {12.0, 11.0, .01089355537047828}, {12.0, 12.0, .01041365883144029}, {12.0, 13.0, .01001867865848564}, {12.0, 14.0, 0.00968923999191334}, {12.0, 15.0, .009411294976563555}, {12.0, 16.0, .009174432043268762}, {12.0, 17.0, .008970786693291802}, {12.0, 18.0, .008794318926790865}, {12.0, 19.0, .008640321527910711}, {12.0, 20.0, .008505077879954796}, {13.0, 10.0, .01111659739668398}, {13.0, 11.0, .01051064829297728}, {13.0, 12.0, .01001867865848564}, {13.0, 13.0, .009613018147953376}, {13.0, 14.0, .009274085618154277}, {13.0, 15.0, 0.0089876637564166}, {13.0, 16.0, .008743200745261382}, {13.0, 17.0, .008532715206686251}, {13.0, 18.0, .008350069108807093}, {13.0, 19.0, .008190472517984874}, {13.0, 20.0, .008050138630244345}, {14.0, 10.0, .01080991216314295}, {14.0, 11.0, 0.0101918899639826}, {14.0, 12.0, 0.00968923999191334}, {14.0, 13.0, .009274085618154277}, {14.0, 14.0, .008926676241967286}, {14.0, 15.0, .008632654302369184}, {14.0, 16.0, .008381351102615795}, {14.0, 17.0, .008164687232662443}, {14.0, 18.0, .007976441942841219}, {14.0, 19.0, .007811755112234388}, {14.0, 20.0, .007666780069317652}, {15.0, 10.0, .01055214134859758}, {15.0, 11.0, .009923438811859604}, {15.0, 12.0, .009411294976563555}, {15.0, 13.0, 0.0089876637564166}, {15.0, 14.0, .008632654302369184}, {15.0, 15.0, 0.00833179217417291}, {15.0, 16.0, .008074310643041299}, {15.0, 17.0, .007852047581145882}, {15.0, 18.0, .007658712051540045}, {15.0, 19.0, .007489384065757007}, {15.0, 20.0, .007340165635725612}, {16.0, 10.0, .01033324912491747}, {16.0, 11.0, .009695052724952705}, {16.0, 12.0, .009174432043268762}, {16.0, 13.0, .008743200745261382}, {16.0, 14.0, .008381351102615795}, {16.0, 15.0, .008074310643041299}, {16.0, 16.0, .007811229919967624}, {16.0, 17.0, .007583876618287594}, {16.0, 18.0, .007385899933505551}, {16.0, 19.0, .007212328560607852}, {16.0, 20.0, .007059220321091879}, {17.0, 10.0, .01014568069918883}, {17.0, 11.0, 0.00949900745283617}, {17.0, 12.0, .008970786693291802}, {17.0, 13.0, .008532715206686251}, {17.0, 14.0, .008164687232662443}, {17.0, 15.0, .007852047581145882}, {17.0, 16.0, .007583876618287594}, {17.0, 17.0, .007351882161431358}, {17.0, 18.0, .007149662089534654}, {17.0, 19.0, .006972200907152378}, {17.0, 20.0, .006815518216094137}, {18.0, 10.0, .009983653199146491}, {18.0, 11.0, .009329379874933402}, {18.0, 12.0, .008794318926790865}, {18.0, 13.0, .008350069108807093}, {18.0, 14.0, .007976441942841219}, {18.0, 15.0, .007658712051540045}, {18.0, 16.0, .007385899933505551}, {18.0, 17.0, .007149662089534654}, {18.0, 18.0, .006943552208153373}, {18.0, 19.0, .006762516574228829}, {18.0, 20.0, .006602541598043117}, {19.0, 10.0, .009842674320242729}, {19.0, 11.0, 0.00918156080743147}, {19.0, 12.0, .008640321527910711}, {19.0, 13.0, .008190472517984874}, {19.0, 14.0, .007811755112234388}, {19.0, 15.0, .007489384065757007}, {19.0, 16.0, .007212328560607852}, {19.0, 17.0, .006972200907152378}, {19.0, 18.0, .006762516574228829}, {19.0, 19.0, .006578188655176814}, {19.0, 20.0, .006415174623476747}, {20.0, 10.0, 0.0097192081956071}, {20.0, 11.0, 0.00905191635141762}, {20.0, 12.0, .008505077879954796}, {20.0, 13.0, .008050138630244345}, {20.0, 14.0, .007666780069317652}, {20.0, 15.0, .007340165635725612}, {20.0, 16.0, .007059220321091879}, {20.0, 17.0, .006815518216094137}, {20.0, 18.0, .006602541598043117}, {20.0, 19.0, .006415174623476747}, {20.0, 20.0, .006249349445691423}, }; @Test void testLogBeta() { final int ulps = 3; for (int i = 0; i < LOG_BETA_REF.length; i++) { final double[] ref = LOG_BETA_REF[i]; final double a = ref[0]; final double b = ref[1]; final double expected = ref[2]; final double actual = LogBeta.value(a, b); final double tol = ulps * Math.ulp(expected); final StringBuilder builder = new StringBuilder(); builder.append(a).append(", ").append(b); Assertions.assertEquals(expected, actual, tol, builder.toString()); } } @Test void testLogBetaNanPositive() { testLogBeta(Double.NaN, Double.NaN, 2); } @Test void testLogBetaPositiveNan() { testLogBeta(Double.NaN, 1, Double.NaN); } @Test void testLogBetaNegativePositive() { testLogBeta(Double.NaN, -1, 2); } @Test void testLogBetaPositiveNegative() { testLogBeta(Double.NaN, 1, -2); } @Test void testLogBetaZeroPositive() { testLogBeta(Double.NaN, 0, 2); } @Test void testLogBetaPositiveZero() { testLogBeta(Double.NaN, 1, 0); } @Test void testLogBetaPositivePositive() { testLogBeta(-0.693147180559945, 1, 2); } private void testLogBeta(double expected, double a, double b) { double actual = LogBeta.value(a, b); Assertions.assertEquals(expected, actual, 1e-15); } private static double logGammaMinusLogGammaSum(final double a, final double b) { /* * Use reflection to access private method. */ try { final Method m = LogBeta.class.getDeclaredMethod("logGammaMinusLogGammaSum", Double.TYPE, Double.TYPE); m.setAccessible(true); return ((Double) m.invoke(null, a, b)).doubleValue(); } catch (NoSuchMethodException e) { Assertions.fail(e.getMessage()); } catch (IllegalAccessException e) { Assertions.fail(e.getMessage()); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof GammaException) { throw (GammaException) e.getTargetException(); } else { Assertions.fail(e.getTargetException().getMessage()); } } return Double.NaN; } @Test void testLogGammaMinusLogGammaSum() { final int ulps = 4; for (int i = 0; i < LOG_GAMMA_MINUS_LOG_GAMMA_SUM_REF.length; i++) { final double[] ref = LOG_GAMMA_MINUS_LOG_GAMMA_SUM_REF[i]; final double a = ref[0]; final double b = ref[1]; final double expected = ref[2]; final double actual = logGammaMinusLogGammaSum(a, b); final double tol = ulps * Math.ulp(expected); final StringBuilder builder = new StringBuilder(); builder.append(a).append(", ").append(b); Assertions.assertEquals(expected, actual, tol, builder.toString()); } } @Test void testLogGammaMinusLogGammaSumPrecondition1() { Assertions.assertThrows(IllegalArgumentException.class, () -> logGammaMinusLogGammaSum(-1, 8) ); } @Test void testLogGammaMinusLogGammaSumPrecondition2() { Assertions.assertThrows(IllegalArgumentException.class, () -> logGammaMinusLogGammaSum(1, 7) ); } private static double sumDeltaMinusDeltaSum(final double a, final double b) { /* * Use reflection to access private method. */ try { final Method m = LogBeta.class.getDeclaredMethod("sumDeltaMinusDeltaSum", Double.TYPE, Double.TYPE); m.setAccessible(true); return ((Double) m.invoke(null, a, b)).doubleValue(); } catch (NoSuchMethodException e) { Assertions.fail(e.getMessage()); } catch (final IllegalAccessException e) { Assertions.fail(e.getMessage()); } catch (final InvocationTargetException e) { if (e.getTargetException() instanceof GammaException) { throw (GammaException) e.getTargetException(); } Assertions.fail(e.getTargetException().getMessage()); } return Double.NaN; } @Test void testSumDeltaMinusDeltaSum() { final int ulps = 3; for (int i = 0; i < SUM_DELTA_MINUS_DELTA_SUM_REF.length; i++) { final double[] ref = SUM_DELTA_MINUS_DELTA_SUM_REF[i]; final double a = ref[0]; final double b = ref[1]; final double expected = ref[2]; final double actual = sumDeltaMinusDeltaSum(a, b); final double tol = ulps * Math.ulp(expected); final StringBuilder builder = new StringBuilder(); builder.append(a).append(", ").append(b); Assertions.assertEquals(expected, actual, tol, builder.toString()); } } @Test void testSumDeltaMinusDeltaSumPrecondition1() { Assertions.assertThrows(IllegalArgumentException.class, () -> sumDeltaMinusDeltaSum(9, 10) ); } @Test void testSumDeltaMinusDeltaSumPrecondition2() { Assertions.assertThrows(IllegalArgumentException.class, () -> sumDeltaMinusDeltaSum(10, 9) ); } }
pmarkiewka/scm-manager
scm-core/src/main/java/sonia/scm/net/HttpConnectionOptions.java
/* * MIT License * * Copyright (c) 2020-present Cloudogu GmbH and Contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package sonia.scm.net; import com.google.common.annotations.VisibleForTesting; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; import javax.annotation.Nullable; import javax.net.ssl.KeyManager; import java.net.URL; import java.util.Arrays; import java.util.Optional; import java.util.concurrent.TimeUnit; /** * Options for establishing a http connection. * The options can be used to create a new http connection * with {@link HttpURLConnectionFactory#create(URL, HttpConnectionOptions)}. * * @since 2.23.0 */ @Getter @ToString @EqualsAndHashCode public final class HttpConnectionOptions { @VisibleForTesting static final int DEFAULT_CONNECTION_TIMEOUT = 30000; @VisibleForTesting static final int DEFAULT_READ_TIMEOUT = 1200000; @Nullable private ProxyConfiguration proxyConfiguration; @Nullable private KeyManager[] keyManagers; private boolean disableCertificateValidation = false; private boolean disableHostnameValidation = false; private int connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; private int readTimeout = DEFAULT_READ_TIMEOUT; private boolean ignoreProxySettings = false; /** * Returns optional local proxy configuration. * @return local proxy configuration or empty optional */ public Optional<ProxyConfiguration> getProxyConfiguration() { return Optional.ofNullable(proxyConfiguration); } /** * Return optional array of key managers for client certificate authentication. * * @return array of key managers or empty optional */ public Optional<KeyManager[]> getKeyManagers() { if (keyManagers != null) { return Optional.of(Arrays.copyOf(keyManagers, keyManagers.length)); } return Optional.empty(); } /** * Disable certificate validation. * <b>WARNING:</b> This option should only be used for internal test. * It should never be used in production, because it is high security risk. * * @return {@code this} */ public HttpConnectionOptions withDisableCertificateValidation() { this.disableCertificateValidation = true; return this; } /** * Disable hostname validation. * <b>WARNING:</b> This option should only be used for internal test. * It should never be used in production, because it is high security risk. * * @return {@code this} */ public HttpConnectionOptions withDisabledHostnameValidation() { this.disableHostnameValidation = true; return this; } /** * Configure the connection timeout. * @param timeout timeout * @param unit unit of the timeout * @return {@code this} */ public HttpConnectionOptions withConnectionTimeout(long timeout, TimeUnit unit) { this.connectionTimeout = (int) unit.toMillis(timeout); return this; } /** * Configure the read timeout. * @param timeout timeout * @param unit unit of the timeout * @return {@code this} */ public HttpConnectionOptions withReadTimeout(long timeout, TimeUnit unit) { this.readTimeout = (int) unit.toMillis(timeout); return this; } /** * Configure a local proxy configuration, if no configuration is set the global default configuration will be used. * @param proxyConfiguration local proxy configuration * @return {@code this} */ public HttpConnectionOptions withProxyConfiguration(ProxyConfiguration proxyConfiguration) { this.proxyConfiguration = proxyConfiguration; return this; } /** * Configure key managers for client certificate authentication. * @param keyManagers key managers * @return {@code this} */ public HttpConnectionOptions withKeyManagers(@Nullable KeyManager... keyManagers) { if (keyManagers != null) { this.keyManagers = Arrays.copyOf(keyManagers, keyManagers.length); } return this; } /** * Ignore proxy settings completely regardless if a local proxy configuration or a global configuration is configured. * @return {@code this} */ public HttpConnectionOptions withIgnoreProxySettings() { this.ignoreProxySettings = true; return this; } }
jforge/vaadin
test/dependency-rewrite-addon/src/main/java/com/vaadin/test/dependencyrewriteaddon/RewriteJQueryFilter.java
package com.vaadin.test.dependencyrewriteaddon; import java.util.ArrayList; import java.util.List; import java.util.Locale; import com.vaadin.server.DependencyFilter; import com.vaadin.server.ServiceInitEvent; import com.vaadin.server.VaadinServiceInitListener; import com.vaadin.ui.Dependency; import com.vaadin.ui.Dependency.Type; public class RewriteJQueryFilter implements DependencyFilter, VaadinServiceInitListener { @Override public List<Dependency> filter(List<Dependency> dependencies, FilterContext filterContext) { List<Dependency> filtered = new ArrayList<>(); for (Dependency dependency : dependencies) { if (dependency.getType() == Type.JAVASCRIPT && dependency.getUrl() .toLowerCase(Locale.ROOT).contains("jquery")) { filtered.add( new Dependency(Type.JAVASCRIPT, "vaadin://jquery.js")); } else { filtered.add(dependency); } } return filtered; } // for compactness, implementing the init listener here @Override public void serviceInit(ServiceInitEvent event) { event.addDependencyFilter(this); } }
AlexRogalskiy/DevArtifacts
master/Currency-Converter-master/Currency-Converter-master/js/translation.js
<filename>master/Currency-Converter-master/Currency-Converter-master/js/translation.js var Translation = { 'it': { 'app-description': 'Currency Converter è una semplice applicazione che ti aiuta a convertire da una valuta ad un\'altra. È anche possibile aggiornare i tassi di cambio ogni volta che si desidera così da avere sempre dei tassi di conversione aggiornati.', 'convert-title': 'Converti', 'from-value-label': 'Valore:', 'from-type-label': 'Da Valuta:', 'to-type-label': 'A Valuta:', 'result-title': 'Risultato', 'copyright-title': 'Creata da Aurelio De Rosa', 'credits-button': 'Crediti', 'update-button': 'Aggiorna dati', 'submit-button': 'Converti', 'reset-button': 'Azzera dati', 'last-update-label': 'Ultimo aggiornamento cambi:' }, 'fr': { 'app-description': 'Currency Converter est simple une application qui vous permet de convertir à partir d\'un monnaie à une autre. Vous pouvez également mettre à jour les taux de change chaque fois que vous le voulez et vous aurez toujours actualisés les résultats en utilisant les taux du marché moyen en direct', 'convert-title': 'Effectuer la convertion', 'from-value-label': 'Valeur:', 'from-type-label': 'À partir de cette devise:', 'to-type-label': 'Vers cette devise:', 'result-title': 'Résultat', 'copyright-title': 'Crée par <NAME>', 'credits-button': 'Crédits', 'update-button': 'Mettre à jour les données', 'submit-button': 'Convertir', 'reset-button': 'Réinitialiser les données', 'last-update-label': 'Dernière mise à jour des changements:' }, 'es': { 'app-description': 'Currency Converter es una sencilla aplicación que te ayuda a convertir de un moneda en otra. También puede actualizar los tipos de cambio y tener las tasas de conversión actualizadas.', 'convert-title': 'Convertir', 'from-value-label': 'Valor:', 'from-type-label': 'De:', 'to-type-label': 'A:', 'result-title': 'Resultado', 'copyright-title': 'Creada por <NAME>', 'credits-button': 'Créditos', 'update-button': 'Actualizar los datos', 'submit-button': 'Convertir', 'reset-button': 'Restablecer los datos', 'last-update-label': 'Cambios de última actualización:' } }
swingflip/C64_mini_VICE
src/arch/msdos/cbmcharsets.c
/* * cbmcharsets.c - CBM lookalike character sets. * * Written by * <NAME> / STA <<EMAIL>> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #include "types.h" #include "cbmcharsets.h" BYTE cbm_charset_1[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x81, 0x81, 0xa5, 0xa5, 0x81, 0x81, 0x99, 0x99, 0x81, 0x81, 0x7e, 0x7e, 0x00, 0x00, 0x7e, 0x7e, 0xff, 0xff, 0xdb, 0xdb, 0xff, 0xff, 0xe7, 0xe7, 0xff, 0xff, 0x7e, 0x7e, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x00, 0x00, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x7f, 0x7f, 0x7f, 0x1c, 0x1c, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xdb, 0xdb, 0xdb, 0xdb, 0xe7, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x0e, 0x0e, 0x05, 0x05, 0x08, 0x08, 0x38, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x38, 0x10, 0x10, 0x38, 0x38, 0x10, 0x10, 0x08, 0x08, 0x0c, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x38, 0x00, 0x00, 0x3e, 0x3e, 0x22, 0x22, 0x3e, 0x3e, 0x22, 0x22, 0x22, 0x22, 0x26, 0x26, 0x66, 0x66, 0x60, 0x60, 0x08, 0x08, 0x2a, 0x2a, 0x14, 0x14, 0x63, 0x63, 0x14, 0x14, 0x2a, 0x2a, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x78, 0x78, 0x7e, 0x7e, 0x7e, 0x7e, 0x78, 0x78, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x1e, 0x1e, 0x7e, 0x7e, 0x7e, 0x7e, 0x1e, 0x1e, 0x06, 0x06, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x5b, 0x5b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x3c, 0x3c, 0x60, 0x60, 0x3c, 0x3c, 0x66, 0x66, 0x3c, 0x3c, 0x06, 0x06, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x7e, 0x7e, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x7e, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x7e, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0c, 0x0c, 0xfe, 0xfe, 0xfe, 0xfe, 0x0c, 0x0c, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30, 0x30, 0x7f, 0x7f, 0x7f, 0x7f, 0x30, 0x30, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0xfe, 0xfe, 0xfe, 0xfe, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x3c, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x3c, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0x66, 0x66, 0xff, 0xff, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x18, 0x18, 0x3e, 0x3e, 0x60, 0x60, 0x3c, 0x3c, 0x06, 0x06, 0x7c, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x62, 0x62, 0x66, 0x66, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x66, 0x66, 0x46, 0x46, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x3c, 0x3c, 0x38, 0x38, 0x67, 0x67, 0x66, 0x66, 0x3f, 0x3f, 0x00, 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x3c, 0xff, 0xff, 0x3c, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x6e, 0x6e, 0x76, 0x76, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x7e, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x06, 0x06, 0x0c, 0x0c, 0x30, 0x30, 0x60, 0x60, 0x7e, 0x7e, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x06, 0x06, 0x1c, 0x1c, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x06, 0x06, 0x0e, 0x0e, 0x1e, 0x1e, 0x66, 0x66, 0x7f, 0x7f, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x7e, 0x7e, 0x60, 0x60, 0x7c, 0x7c, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x60, 0x60, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x7e, 0x7e, 0x66, 0x66, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x3e, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x0e, 0x0e, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x70, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x70, 0x70, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x6e, 0x6e, 0x6e, 0x6e, 0x60, 0x60, 0x62, 0x62, 0x3c, 0x3c, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x7e, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x7c, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x78, 0x78, 0x6c, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0x6c, 0x78, 0x78, 0x00, 0x00, 0x7e, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x78, 0x78, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x7e, 0x00, 0x00, 0x7e, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x78, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x60, 0x60, 0x6e, 0x6e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x00, 0x00, 0x1e, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x6c, 0x38, 0x38, 0x00, 0x00, 0x66, 0x66, 0x6c, 0x6c, 0x78, 0x78, 0x70, 0x70, 0x78, 0x78, 0x6c, 0x6c, 0x66, 0x66, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x7e, 0x00, 0x00, 0x63, 0x63, 0x77, 0x77, 0x7f, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x66, 0x66, 0x76, 0x76, 0x7e, 0x7e, 0x7e, 0x7e, 0x6e, 0x6e, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x0e, 0x0e, 0x00, 0x00, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x7c, 0x78, 0x78, 0x6c, 0x6c, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x60, 0x60, 0x3c, 0x3c, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x7e, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x7f, 0x77, 0x77, 0x63, 0x63, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x7e, 0x7e, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x7e, 0x7e, 0x00, 0x00, 0x3c, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03, 0x00, 0x00, 0x3c, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x3c, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x06, 0x06, 0x3e, 0x3e, 0x66, 0x66, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x3e, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x7e, 0x7e, 0x60, 0x60, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x18, 0x18, 0x3e, 0x3e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x3e, 0x06, 0x06, 0x7c, 0x7c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x38, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3c, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x6c, 0x6c, 0x78, 0x78, 0x6c, 0x6c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x3e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x66, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x60, 0x60, 0x3c, 0x3c, 0x06, 0x06, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x7f, 0x3e, 0x3e, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x3e, 0x0c, 0x0c, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x7e, 0x7e, 0x00, 0x00, 0x1c, 0x1c, 0x30, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0x30, 0x1c, 0x1c, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x38, 0x38, 0x0c, 0x0c, 0x0c, 0x0c, 0x06, 0x06, 0x0c, 0x0c, 0x0c, 0x0c, 0x38, 0x38, 0x00, 0x00, 0x3b, 0x3b, 0x6e, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x7f, 0x7f, 0x7f, 0x1c, 0x1c, 0x3e, 0x3e, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xf0, 0xf0, 0x38, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x1c, 0x0f, 0x0f, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x38, 0x38, 0xf0, 0xf0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xe0, 0xe0, 0x70, 0x70, 0x38, 0x38, 0x1c, 0x1c, 0x0e, 0x0e, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x0e, 0x0e, 0x1c, 0x1c, 0x38, 0x38, 0x70, 0x70, 0xe0, 0xe0, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x3c, 0x3c, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x0f, 0x0f, 0x1c, 0x1c, 0x18, 0x18, 0x18, 0x18, 0xc3, 0xc3, 0xe7, 0xe7, 0x7e, 0x7e, 0x3c, 0x3c, 0x3c, 0x3c, 0x7e, 0x7e, 0xe7, 0xe7, 0xc3, 0xc3, 0x00, 0x00, 0x3c, 0x3c, 0x7e, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x7e, 0x3c, 0x3c, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xc0, 0xc0, 0xc0, 0xc0, 0x30, 0x30, 0x30, 0x30, 0xc0, 0xc0, 0xc0, 0xc0, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x3e, 0x3e, 0x76, 0x76, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x66, 0x66, 0x3c, 0x3c, 0x00, 0x00, 0x0c, 0x0c, 0x12, 0x12, 0x30, 0x30, 0x7c, 0x7c, 0x30, 0x30, 0x62, 0x62, 0xfc, 0xfc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x99, 0x99, 0xcc, 0xcc, 0x66, 0x66, 0x33, 0x33, 0x99, 0x99, 0xcc, 0xcc, 0x66, 0x66, 0xcc, 0xcc, 0x99, 0x99, 0x33, 0x33, 0x66, 0x66, 0xcc, 0xcc, 0x99, 0x99, 0x33, 0x33, 0x66, 0x66, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x66, 0x66, 0xcc, 0xcc, 0xcc, 0xcc, 0x66, 0x66, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0xcc, 0xcc, 0x66, 0x66, 0x66, 0x66, 0xcc, 0xcc, 0x88, 0x88, 0x00, 0x00, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0xe6, 0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x66, 0x66, 0xe6, 0xe6, 0xe6, 0xe6, 0x06, 0x06, 0x06, 0x06, 0xe6, 0xe6, 0xe6, 0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xe6, 0xe6, 0xe6, 0xe6, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0xe6, 0xe6, 0x06, 0x06, 0x06, 0x06, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x67, 0x67, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x67, 0x67, 0x60, 0x60, 0x60, 0x60, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x60, 0x67, 0x67, 0x67, 0x67, 0x66, 0x66, 0x66, 0x66, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0xe7, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x67, 0x67, 0x60, 0x60, 0x60, 0x60, 0x67, 0x67, 0x67, 0x67, 0x66, 0x66, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x66, 0x66, 0xe7, 0xe7, 0xe7, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0xe7, 0xe7, 0x66, 0x66, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0xff, 0xff, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x06, 0x06, 0x6c, 0x6c, 0x78, 0x78, 0x70, 0x70, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; BYTE cbm_charset_2[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3e, 0x1c, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x0f, 0x03, 0x07, 0x0d, 0x39, 0x6c, 0x44, 0x44, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x22, 0x22, 0x36, 0x1c, 0x08, 0x08, 0x3e, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x0c, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x22, 0x3e, 0x22, 0x22, 0x22, 0x26, 0x26, 0x66, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x49, 0x2a, 0x14, 0x63, 0x14, 0x2a, 0x49, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38, 0x3c, 0x3e, 0x3e, 0x3c, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x1c, 0x3c, 0x7c, 0x7c, 0x3c, 0x1c, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7b, 0x5b, 0x5b, 0x3b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x60, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x06, 0x06, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c, 0xfe, 0xfe, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x7f, 0x7f, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3e, 0x60, 0x60, 0x3c, 0x06, 0x06, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x38, 0x67, 0x66, 0x66, 0x66, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x6e, 0x76, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x1c, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0e, 0x1e, 0x1e, 0x66, 0x66, 0x7f, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x60, 0x7c, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0e, 0x18, 0x30, 0x60, 0x60, 0x30, 0x18, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x18, 0x0c, 0x06, 0x06, 0x0c, 0x18, 0x70, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x6e, 0x6e, 0x6e, 0x60, 0x62, 0x62, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x6e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x6c, 0x6c, 0x78, 0x78, 0x6c, 0x6c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x77, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x76, 0x7e, 0x6e, 0x6e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x78, 0x6c, 0x6c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x3c, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x77, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x7e, 0x60, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x18, 0x3e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x7f, 0x7f, 0x6b, 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x60, 0x60, 0x3c, 0x06, 0x06, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x7e, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf0, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x38, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0x80, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0x80, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x7e, 0x7e, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x36, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3e, 0x1c, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x81, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x66, 0x66, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xc0, 0xc0, 0xc0, 0xc0, 0x30, 0x30, 0x30, 0x30, 0xc0, 0xc0, 0xc0, 0xc0, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3e, 0x76, 0x76, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x32, 0x30, 0x7c, 0x30, 0x30, 0x62, 0x62, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x99, 0x99, 0xcc, 0xcc, 0x66, 0x66, 0x33, 0x33, 0x99, 0x99, 0xcc, 0xcc, 0x66, 0x66, 0xcc, 0xcc, 0x99, 0x99, 0x33, 0x33, 0x66, 0x66, 0xcc, 0xcc, 0x99, 0x99, 0x33, 0x33, 0x66, 0x66, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x66, 0xcc, 0xcc, 0x66, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xcc, 0x66, 0x66, 0xcc, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0xee, 0xee, 0xbb, 0xbb, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0x06, 0x06, 0xe6, 0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x06, 0x06, 0xe6, 0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0x06, 0x06, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x60, 0x60, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x60, 0x60, 0x67, 0x67, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe7, 0xe7, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xe7, 0xe7, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x60, 0x60, 0x67, 0x67, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe7, 0xe7, 0x00, 0x00, 0xe7, 0xe7, 0x66, 0x66, 0x66, 0x66, 0x66, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x06, 0x06, 0x6c, 0x6c, 0x78, 0x78, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* ------------------------------------------------------------------------- */ /* Conversion tables. */ /* PETSCII lowercase/uppercase to extended ASCII converter table (used when the C64 character set is on). */ BYTE cbm_petscii_business_to_charset[0x100] = { 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x5B, 0xA9, 0x5D, 0x18, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x5B, 0xA9, 0x5D, 0x18, 0x1B, 0x80, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x9B, 0x9C, 0x9D, 0xAA, 0xAB, 0x80, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x9B, 0x9C, 0x9D, 0xAA, 0xAB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xAC, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xA0, 0xA1, 0xFB, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0x80, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x9B, 0x9C, 0x9D, 0xAA, 0xAB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xAC, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xA0, 0xA1, 0xFB, 0xA3, 0xA4, 0xA5, 0xA6, 0xAA }; /* PETSCII uppercase/graphics to extended ASCII converter table (used when the C64 character set is on). */ BYTE cbm_petscii_graphics_to_charset[0x100] = { 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0xA9, 0x5D, 0x18, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0xA9, 0x5D, 0x18, 0x1B, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0x9E }; /* FIXME: These are currently unused. */ BYTE cbm_petscii_business_to_ascii[0x100] = { 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x5B, 0x9C, 0x5D, 0x18, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x5B, 0x9C, 0x5D, 0x18, 0x1B, 0xC4, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xC5, 0xF9, 0xB3, 0xF9, 0xF9, 0xC4, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xC5, 0xF9, 0xB3, 0xF9, 0xF9, 0x5F, 0xDD, 0xDC, 0xC4, 0xC4, 0xB3, 0xF9, 0xB3, 0xF9, 0xF9, 0xB3, 0xC3, 0xF9, 0xC0, 0xBF, 0xC4, 0xDA, 0xC1, 0xC2, 0xB4, 0xB3, 0xDD, 0xDE, 0xC4, 0xDF, 0xDC, 0xFB, 0xF9, 0xF9, 0xD9, 0xF9, 0xF9, 0xC4, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xC5, 0xF9, 0xB3, 0xF9, 0xF9, 0x5F, 0xDD, 0xDC, 0xC4, 0xC4, 0xB3, 0xF9, 0xB3, 0xF9, 0xF9, 0xB3, 0xC3, 0xF9, 0xC0, 0xBF, 0xC4, 0xDA, 0xC1, 0xC2, 0xB4, 0xB3, 0xDD, 0xDE, 0xC4, 0xDF, 0xDC, 0xFB, 0xF9, 0xF9, 0xD9, 0xF9, 0xF9 }; BYTE cbm_petscii_graphics_to_ascii[0x100] = { 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x9C, 0x5D, 0x18, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x9C, 0x5D, 0x18, 0x1B, 0xC4, 0x06, 0xB3, 0xC4, 0xC4, 0xC4, 0xC4, 0xB3, 0xB3, 0xBF, 0xC0, 0xD9, 0xC0, 0x5C, 0x2F, 0xDA, 0xBF, 0x07, 0xC4, 0x03, 0xB3, 0xDA, 0x58, 0x09, 0x05, 0xB3, 0x04, 0xC5, 0xF9, 0xB3, 0xE3, 0xF9, 0xC4, 0x06, 0xB3, 0xC4, 0xC4, 0xC4, 0xC4, 0xB3, 0xB3, 0xBF, 0xC0, 0xD9, 0xC0, 0x5C, 0x2F, 0xDA, 0xBF, 0x07, 0xC4, 0x03, 0xB3, 0xDA, 0x58, 0x09, 0x05, 0xB3, 0x04, 0xC5, 0xF9, 0xB3, 0xE3, 0xF9, 0x5F, 0xDD, 0xDC, 0xC4, 0xC4, 0xB3, 0xF9, 0xB3, 0xF9, 0xF9, 0xB3, 0xC3, 0xF9, 0xC0, 0xBF, 0xC4, 0xDA, 0xC1, 0xC2, 0xB4, 0xB3, 0xDD, 0xDE, 0xC4, 0xDF, 0xDC, 0xD9, 0xF9, 0xF9, 0xD9, 0xF9, 0xF9, 0xC4, 0x06, 0xB3, 0xC4, 0xC4, 0xC4, 0xC4, 0xB3, 0xB3, 0xBF, 0xC0, 0xD9, 0xC0, 0x5C, 0x2F, 0xDA, 0xBF, 0x07, 0xC4, 0x03, 0xB3, 0xDA, 0x58, 0x09, 0x05, 0xB3, 0x04, 0xC5, 0xF9, 0xB3, 0xE3, 0xF9, 0x5F, 0xDD, 0xDC, 0xC4, 0xC4, 0xB3, 0xF9, 0xB3, 0xF9, 0xF9, 0xB3, 0xC3, 0xF9, 0xC0, 0xBF, 0xC4, 0xDA, 0xC1, 0xC2, 0xB4, 0xB3, 0xDD, 0xDE, 0xC4, 0xDF, 0xDC, 0xD9, 0xF9, 0xF9, 0xD9, 0xF9, 0xE3 }; BYTE cbm_ascii_to_petscii[0x100] = { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0x5B, 0xCD, 0x5D, 0x5E, 0xA0, 0x20, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0xDD, 0x5D, 0x2D, 0x20, 0xC3, 0x55, 0x45, 0x41, 0x41, 0x41, 0x41, 0x43, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0xC1, 0xC1, 0xC5, 0x41, 0xC1, 0x4F, 0x4F, 0x4F, 0x55, 0x55, 0x59, 0xCF, 0xD5, 0x43, 0x5C, 0xD9, 0x20, 0x20, 0x41, 0x45, 0x4F, 0x55, 0x4E, 0xCE, 0x20, 0x20, 0x3F, 0x20, 0x20, 0x20, 0x20, 0x21, 0x20, 0x20, 0xA6, 0xA6, 0xA6, 0xDD, 0xB3, 0xB3, 0xB3, 0xAE, 0xAE, 0xB3, 0xA6, 0xAE, 0xBD, 0xBD, 0xBD, 0xAE, 0xAD, 0xB1, 0xB2, 0xAB, 0xC0, 0xDB, 0xAB, 0xAB, 0xAD, 0xB0, 0xB1, 0xB2, 0xAB, 0xC0, 0xDB, 0xB1, 0xB1, 0xB2, 0xB2, 0xAD, 0xAD, 0xB0, 0xB0, 0xDB, 0xDB, 0xBD, 0xB0, 0x20, 0xA2, 0xA1, 0xB6, 0xB9, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
trolleksii/kafka-ui
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/pages/Pages.java
<gh_stars>1000+ package com.provectus.kafka.ui.pages; public class Pages { public static Pages INSTANCE = new Pages(); public MainPage mainPage = new MainPage(); public TopicsList topicsList = new TopicsList(); public TopicView topicView = new TopicView(); public ConnectorsList connectorsList = new ConnectorsList(); public ConnectorsView connectorsView = new ConnectorsView(); public MainPage open() { return openMainPage(); } public MainPage openMainPage() { return mainPage.goTo(); } public TopicsList openTopicsList(String clusterName) { return topicsList.goTo(clusterName); } public TopicView openTopicView(String clusterName, String topicName) { return topicView.goTo(clusterName, topicName); } public ConnectorsList openConnectorsList(String clusterName) { return connectorsList.goTo(clusterName); } public ConnectorsView openConnectorsView(String clusterName, String connectorName) { return connectorsView.goTo(clusterName, connectorName); } }
vishal230400/Coding-Solutions
src/com/vishal/codeforces/Q339/Q339A/Solution339A.java
package com.vishal.codeforces.Q339.Q339A; import java.util.*; import static java.lang.String.valueOf; public class Solution339A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); char[]a=str.replace("+","").toCharArray(); Arrays.sort(a); String b=valueOf(a).replaceAll("(?i)([0-9])","$1+"); System.out.println(b.substring(0,b.length()-1)); sc.close(); } }
CogRob/TritonBot
cogrob_ros/speak_text_logging/src/speak_text_logger_node.cc
<gh_stars>1-10 // Copyright (c) 2018, The Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California nor the // names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #include <memory> #include "absl/memory/memory.h" #include "cogrob/universal_logger/universal_logger.h" #include "cogrob/universal_logger/universal_logger_flusher.h" #include "cogrob/universal_logger/universal_logger_interface.h" #include "ros/ros.h" #include "speak_text_msgs/SpeakTextActionGoal.h" #include "speak_text_msgs/SpeakTextActionResult.h" #include "third_party/gflags.h" #include "third_party/glog.h" #include "speak_text_logger.h" using speak_text_logging::SpeakTextLogger; using cogrob::universal_logger::UniversalLogger; using cogrob::universal_logger::UniversalLoggerFlusher; using cogrob::universal_logger::UniversalLoggerInterface; int main(int argc, char* argv[]) { google::InitGoogleLogging(argv[0]); gflags::ParseCommandLineFlags(&argc, &argv, true); ros::init(argc, argv, "speak_text_logger_node"); UniversalLoggerFlusher logger_flusher; auto universal_logger = absl::make_unique<UniversalLogger>("dialogue/robot_speech"); CHECK_OK(universal_logger->RegisterWithFlusher(&logger_flusher)); SpeakTextLogger speak_text_logger(std::move(universal_logger)); ros::NodeHandle ros_node; auto goal_callback = [&speak_text_logger] ( const speak_text_msgs::SpeakTextActionGoal::ConstPtr& msg) { speak_text_logger.ActionGoalCallback(msg); }; ros::Subscriber goal_sub = ros_node.subscribe<speak_text_msgs::SpeakTextActionGoal>( "/cogrob/speak_text_action/goal", 10, goal_callback); auto result_callback = [&speak_text_logger] ( const speak_text_msgs::SpeakTextActionResult::ConstPtr& msg) { speak_text_logger.ActionResultCallback(msg); }; ros::Subscriber result_sub = ros_node.subscribe<speak_text_msgs::SpeakTextActionResult>( "/cogrob/speak_text_action/result", 10, result_callback); ros::spin(); return 0; }
akarnokd/akarnokd-misc
src/test/java/hu/akarnokd/rxjava2/TestMockitoCalls.java
package hu.akarnokd.rxjava2; import static org.mockito.Mockito.*; import java.util.List; import org.junit.Test; import io.reactivex.subjects.CompletableSubject; public class TestMockitoCalls { @Test public void test() { @SuppressWarnings("unchecked") List<Integer> list = mock(List.class); CompletableSubject source = CompletableSubject.create(); source.doOnSubscribe(v -> list.add(1)) .doOnError(e -> list.remove(1)) .doOnComplete(() -> list.remove(1)) .subscribe(); source.onComplete(); verify(list).add(1); verify(list).remove(1); verifyNoMoreInteractions(list); } }
g7401/pigeon
pigeon-gps/src/main/java/io/g740/pigeon/biz/object/dto/dictionary/UpdateDictionaryBuildProcessDefDto.java
package io.g740.pigeon.biz.object.dto.dictionary; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import io.g740.pigeon.biz.object.dto.general.SqlBuildStrategyContentDto; import io.g740.pigeon.biz.object.dto.serialization.DictionaryBuildStrategyTypeEnumDeserializer; import io.g740.pigeon.biz.object.dto.serialization.ScheduleTypeEnumJsonDeserializer; import io.g740.pigeon.biz.share.constants.DictionaryBuildStrategyTypeEnum; import io.g740.pigeon.biz.share.constants.ScheduleTypeEnum; import lombok.Data; /** * @author bbottong */ @Data public class UpdateDictionaryBuildProcessDefDto { private Long uid; /** * 是否启用该流程 */ private Boolean enabled; /** * 流程调度类型 */ @JsonDeserialize(using = ScheduleTypeEnumJsonDeserializer.class) private ScheduleTypeEnum scheduleType; /** * 流程调度明细 */ private String scheduleTypeExtDetails; /** * 构建策略类型 */ @JsonDeserialize(using = DictionaryBuildStrategyTypeEnumDeserializer.class) private DictionaryBuildStrategyTypeEnum buildStrategyType; /** * SQL构建策略内容 */ private SqlBuildStrategyContentDto sqlBuildStrategyContent; /** * 指定字典类目的UID */ private Long dictionaryCategoryUid; }
zzzhr1990/common-grpc
go/services/tickets/tickets/tickets.pb.go
<filename>go/services/tickets/tickets/tickets.pb.go<gh_stars>0 // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 // protoc v3.15.5 // source: tickets/tickets.proto package tickets import ( common "github.com/zzzhr1990/common-grpc/go/common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) type Ticket struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Identity int64 `protobuf:"varint,1,opt,name=identity,proto3" json:"identity,omitempty"` UserIdentity int64 `protobuf:"varint,2,opt,name=user_identity,json=userIdentity,proto3" json:"user_identity,omitempty"` Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` ReplyUserIdentity int64 `protobuf:"varint,4,opt,name=reply_user_identity,json=replyUserIdentity,proto3" json:"reply_user_identity,omitempty"` Type int32 `protobuf:"varint,5,opt,name=type,proto3" json:"type,omitempty"` Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` CreateTime int64 `protobuf:"varint,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` RefreshTime int64 `protobuf:"varint,8,opt,name=refresh_time,json=refreshTime,proto3" json:"refresh_time,omitempty"` Message string `protobuf:"bytes,9,opt,name=message,proto3" json:"message,omitempty"` Images string `protobuf:"bytes,10,opt,name=images,proto3" json:"images,omitempty"` } func (x *Ticket) Reset() { *x = Ticket{} if protoimpl.UnsafeEnabled { mi := &file_tickets_tickets_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Ticket) String() string { return protoimpl.X.MessageStringOf(x) } func (*Ticket) ProtoMessage() {} func (x *Ticket) ProtoReflect() protoreflect.Message { mi := &file_tickets_tickets_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Ticket.ProtoReflect.Descriptor instead. func (*Ticket) Descriptor() ([]byte, []int) { return file_tickets_tickets_proto_rawDescGZIP(), []int{0} } func (x *Ticket) GetIdentity() int64 { if x != nil { return x.Identity } return 0 } func (x *Ticket) GetUserIdentity() int64 { if x != nil { return x.UserIdentity } return 0 } func (x *Ticket) GetTitle() string { if x != nil { return x.Title } return "" } func (x *Ticket) GetReplyUserIdentity() int64 { if x != nil { return x.ReplyUserIdentity } return 0 } func (x *Ticket) GetType() int32 { if x != nil { return x.Type } return 0 } func (x *Ticket) GetStatus() int32 { if x != nil { return x.Status } return 0 } func (x *Ticket) GetCreateTime() int64 { if x != nil { return x.CreateTime } return 0 } func (x *Ticket) GetRefreshTime() int64 { if x != nil { return x.RefreshTime } return 0 } func (x *Ticket) GetMessage() string { if x != nil { return x.Message } return "" } func (x *Ticket) GetImages() string { if x != nil { return x.Images } return "" } type Reply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Identity int64 `protobuf:"varint,1,opt,name=identity,proto3" json:"identity,omitempty"` UserIdentity int64 `protobuf:"varint,2,opt,name=user_identity,json=userIdentity,proto3" json:"user_identity,omitempty"` TicketIdentity int64 `protobuf:"varint,4,opt,name=ticket_identity,json=ticketIdentity,proto3" json:"ticket_identity,omitempty"` // int32 type = 5; // int32 status = 6; CreateTime int64 `protobuf:"varint,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // string create_address = 8; Message string `protobuf:"bytes,9,opt,name=message,proto3" json:"message,omitempty"` Images string `protobuf:"bytes,10,opt,name=images,proto3" json:"images,omitempty"` } func (x *Reply) Reset() { *x = Reply{} if protoimpl.UnsafeEnabled { mi := &file_tickets_tickets_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Reply) String() string { return protoimpl.X.MessageStringOf(x) } func (*Reply) ProtoMessage() {} func (x *Reply) ProtoReflect() protoreflect.Message { mi := &file_tickets_tickets_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Reply.ProtoReflect.Descriptor instead. func (*Reply) Descriptor() ([]byte, []int) { return file_tickets_tickets_proto_rawDescGZIP(), []int{1} } func (x *Reply) GetIdentity() int64 { if x != nil { return x.Identity } return 0 } func (x *Reply) GetUserIdentity() int64 { if x != nil { return x.UserIdentity } return 0 } func (x *Reply) GetTicketIdentity() int64 { if x != nil { return x.TicketIdentity } return 0 } func (x *Reply) GetCreateTime() int64 { if x != nil { return x.CreateTime } return 0 } func (x *Reply) GetMessage() string { if x != nil { return x.Message } return "" } func (x *Reply) GetImages() string { if x != nil { return x.Images } return "" } type TicketListRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields UserIdentity int64 `protobuf:"varint,2,opt,name=user_identity,json=userIdentity,proto3" json:"user_identity,omitempty"` // string path = 3; ListInfo *common.ListInfo `protobuf:"bytes,4,opt,name=list_info,json=listInfo,proto3" json:"list_info,omitempty"` OrderBy []*common.OrderByRequest `protobuf:"bytes,5,rep,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` // OrderFilterRequest filter = 6; } func (x *TicketListRequest) Reset() { *x = TicketListRequest{} if protoimpl.UnsafeEnabled { mi := &file_tickets_tickets_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *TicketListRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*TicketListRequest) ProtoMessage() {} func (x *TicketListRequest) ProtoReflect() protoreflect.Message { mi := &file_tickets_tickets_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use TicketListRequest.ProtoReflect.Descriptor instead. func (*TicketListRequest) Descriptor() ([]byte, []int) { return file_tickets_tickets_proto_rawDescGZIP(), []int{2} } func (x *TicketListRequest) GetUserIdentity() int64 { if x != nil { return x.UserIdentity } return 0 } func (x *TicketListRequest) GetListInfo() *common.ListInfo { if x != nil { return x.ListInfo } return nil } func (x *TicketListRequest) GetOrderBy() []*common.OrderByRequest { if x != nil { return x.OrderBy } return nil } type ReplyListRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields TicketIdentity int64 `protobuf:"varint,1,opt,name=ticket_identity,json=ticketIdentity,proto3" json:"ticket_identity,omitempty"` UserIdentity int64 `protobuf:"varint,2,opt,name=user_identity,json=userIdentity,proto3" json:"user_identity,omitempty"` // string path = 3; ListInfo *common.ListInfo `protobuf:"bytes,4,opt,name=list_info,json=listInfo,proto3" json:"list_info,omitempty"` OrderBy []*common.OrderByRequest `protobuf:"bytes,5,rep,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` // OrderFilterRequest filter = 6; } func (x *ReplyListRequest) Reset() { *x = ReplyListRequest{} if protoimpl.UnsafeEnabled { mi := &file_tickets_tickets_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ReplyListRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*ReplyListRequest) ProtoMessage() {} func (x *ReplyListRequest) ProtoReflect() protoreflect.Message { mi := &file_tickets_tickets_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use ReplyListRequest.ProtoReflect.Descriptor instead. func (*ReplyListRequest) Descriptor() ([]byte, []int) { return file_tickets_tickets_proto_rawDescGZIP(), []int{3} } func (x *ReplyListRequest) GetTicketIdentity() int64 { if x != nil { return x.TicketIdentity } return 0 } func (x *ReplyListRequest) GetUserIdentity() int64 { if x != nil { return x.UserIdentity } return 0 } func (x *ReplyListRequest) GetListInfo() *common.ListInfo { if x != nil { return x.ListInfo } return nil } func (x *ReplyListRequest) GetOrderBy() []*common.OrderByRequest { if x != nil { return x.OrderBy } return nil } // //message OrderFilterRequest { //string identity = 1; //int64 plan_type = 2; //string path = 3; //} type TicketListResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data []*Ticket `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` } func (x *TicketListResponse) Reset() { *x = TicketListResponse{} if protoimpl.UnsafeEnabled { mi := &file_tickets_tickets_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *TicketListResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*TicketListResponse) ProtoMessage() {} func (x *TicketListResponse) ProtoReflect() protoreflect.Message { mi := &file_tickets_tickets_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use TicketListResponse.ProtoReflect.Descriptor instead. func (*TicketListResponse) Descriptor() ([]byte, []int) { return file_tickets_tickets_proto_rawDescGZIP(), []int{4} } func (x *TicketListResponse) GetData() []*Ticket { if x != nil { return x.Data } return nil } type ReplyListResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Ticket *Ticket `protobuf:"bytes,1,opt,name=Ticket,proto3" json:"Ticket,omitempty"` Data []*Reply `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"` } func (x *ReplyListResponse) Reset() { *x = ReplyListResponse{} if protoimpl.UnsafeEnabled { mi := &file_tickets_tickets_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *ReplyListResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*ReplyListResponse) ProtoMessage() {} func (x *ReplyListResponse) ProtoReflect() protoreflect.Message { mi := &file_tickets_tickets_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use ReplyListResponse.ProtoReflect.Descriptor instead. func (*ReplyListResponse) Descriptor() ([]byte, []int) { return file_tickets_tickets_proto_rawDescGZIP(), []int{5} } func (x *ReplyListResponse) GetTicket() *Ticket { if x != nil { return x.Ticket } return nil } func (x *ReplyListResponse) GetData() []*Reply { if x != nil { return x.Data } return nil } var File_tickets_tickets_proto protoreflect.FileDescriptor var file_tickets_tickets_proto_rawDesc = []byte{ 0x0a, 0x15, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x2f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x1a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x02, 0x0a, 0x06, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x05, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x11, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x2f, 0x0a, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0xc6, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x2f, 0x0a, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0x3a, 0x0a, 0x12, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x62, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x06, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x06, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xef, 0x03, 0x0a, 0x0e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x1a, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x1a, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x1a, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x7a, 0x7a, 0x7a, 0x68, 0x72, 0x31, 0x39, 0x39, 0x30, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x2f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_tickets_tickets_proto_rawDescOnce sync.Once file_tickets_tickets_proto_rawDescData = file_tickets_tickets_proto_rawDesc ) func file_tickets_tickets_proto_rawDescGZIP() []byte { file_tickets_tickets_proto_rawDescOnce.Do(func() { file_tickets_tickets_proto_rawDescData = protoimpl.X.CompressGZIP(file_tickets_tickets_proto_rawDescData) }) return file_tickets_tickets_proto_rawDescData } var file_tickets_tickets_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_tickets_tickets_proto_goTypes = []interface{}{ (*Ticket)(nil), // 0: services.Ticket (*Reply)(nil), // 1: services.Reply (*TicketListRequest)(nil), // 2: services.TicketListRequest (*ReplyListRequest)(nil), // 3: services.ReplyListRequest (*TicketListResponse)(nil), // 4: services.TicketListResponse (*ReplyListResponse)(nil), // 5: services.ReplyListResponse (*common.ListInfo)(nil), // 6: services.ListInfo (*common.OrderByRequest)(nil), // 7: services.OrderByRequest } var file_tickets_tickets_proto_depIdxs = []int32{ 6, // 0: services.TicketListRequest.list_info:type_name -> services.ListInfo 7, // 1: services.TicketListRequest.order_by:type_name -> services.OrderByRequest 6, // 2: services.ReplyListRequest.list_info:type_name -> services.ListInfo 7, // 3: services.ReplyListRequest.order_by:type_name -> services.OrderByRequest 0, // 4: services.TicketListResponse.data:type_name -> services.Ticket 0, // 5: services.ReplyListResponse.Ticket:type_name -> services.Ticket 1, // 6: services.ReplyListResponse.data:type_name -> services.Reply 0, // 7: services.TicketsService.Create:input_type -> services.Ticket 2, // 8: services.TicketsService.List:input_type -> services.TicketListRequest 3, // 9: services.TicketsService.ListReply:input_type -> services.ReplyListRequest 0, // 10: services.TicketsService.Get:input_type -> services.Ticket 1, // 11: services.TicketsService.GetReply:input_type -> services.Reply 1, // 12: services.TicketsService.ReplyTicket:input_type -> services.Reply 0, // 13: services.TicketsService.Close:input_type -> services.Ticket 0, // 14: services.TicketsService.Delete:input_type -> services.Ticket 1, // 15: services.TicketsService.DeleteReply:input_type -> services.Reply 0, // 16: services.TicketsService.Create:output_type -> services.Ticket 4, // 17: services.TicketsService.List:output_type -> services.TicketListResponse 5, // 18: services.TicketsService.ListReply:output_type -> services.ReplyListResponse 0, // 19: services.TicketsService.Get:output_type -> services.Ticket 1, // 20: services.TicketsService.GetReply:output_type -> services.Reply 1, // 21: services.TicketsService.ReplyTicket:output_type -> services.Reply 0, // 22: services.TicketsService.Close:output_type -> services.Ticket 0, // 23: services.TicketsService.Delete:output_type -> services.Ticket 1, // 24: services.TicketsService.DeleteReply:output_type -> services.Reply 16, // [16:25] is the sub-list for method output_type 7, // [7:16] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name 7, // [7:7] is the sub-list for extension extendee 0, // [0:7] is the sub-list for field type_name } func init() { file_tickets_tickets_proto_init() } func file_tickets_tickets_proto_init() { if File_tickets_tickets_proto != nil { return } if !protoimpl.UnsafeEnabled { file_tickets_tickets_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Ticket); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_tickets_tickets_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Reply); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_tickets_tickets_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TicketListRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_tickets_tickets_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReplyListRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_tickets_tickets_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TicketListResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_tickets_tickets_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReplyListResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_tickets_tickets_proto_rawDesc, NumEnums: 0, NumMessages: 6, NumExtensions: 0, NumServices: 1, }, GoTypes: file_tickets_tickets_proto_goTypes, DependencyIndexes: file_tickets_tickets_proto_depIdxs, MessageInfos: file_tickets_tickets_proto_msgTypes, }.Build() File_tickets_tickets_proto = out.File file_tickets_tickets_proto_rawDesc = nil file_tickets_tickets_proto_goTypes = nil file_tickets_tickets_proto_depIdxs = nil }
jamesmunns/nRF5-sdk
examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/main.c
<reponame>jamesmunns/nRF5-sdk /** * Copyright (c) 2016 - 2017, Nordic Semiconductor ASA * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /**@cond To Make Doxygen skip documentation generation for this file. * @{ */ #include <stdbool.h> #include <stdint.h> #include <string.h> #include <stdio.h> #include "amt.h" #include "counter.h" #include "sdk_config.h" #include "boards.h" #include "bsp.h" #include "bsp_btn_ble.h" #include "nrf.h" #include "ble.h" #include "ble_hci.h" #include "nordic_common.h" #include "nrf_gpio.h" #include "ble_advdata.h" #include "ble_srv_common.h" #include "softdevice_handler.h" #include "nrf_ble_gatt.h" #include "app_timer.h" #include "app_error.h" #include "ble_conn_params.h" #define NRF_LOG_MODULE_NAME "APP" #include "nrf_log.h" #include "nrf_log_ctrl.h" #define CONN_INTERVAL_DEFAULT (uint16_t)(MSEC_TO_UNITS(7.5, UNIT_1_25_MS)) /**< Default connection interval used at connection establishment by central side. */ #define CONN_INTERVAL_MIN (uint16_t)(MSEC_TO_UNITS(7.5, UNIT_1_25_MS)) /**< Minimum acceptable connection interval, in 1.25 ms units. */ #define CONN_INTERVAL_MAX (uint16_t)(MSEC_TO_UNITS(500, UNIT_1_25_MS)) /**< Maximum acceptable connection interval, in 1.25 ms units. */ #define CONN_SUP_TIMEOUT (uint16_t)(MSEC_TO_UNITS(4000, UNIT_10_MS)) /**< Connection supervisory timeout (4 seconds). */ #define SLAVE_LATENCY 0 /**< Slave latency. */ #define SCAN_ADV_LED BSP_BOARD_LED_0 #define READY_LED BSP_BOARD_LED_1 #define PROGRESS_LED BSP_BOARD_LED_2 #define DONE_LED BSP_BOARD_LED_3 #define YES 'y' #define ONE '1' #define TWO '2' #define THREE '3' #define FOUR '4' #define ENTER '\r' #define BOARD_TESTER_BUTTON BSP_BUTTON_2 /**< Button to press at beginning of the test to indicate that this board is connected to the PC and takes input from it via the UART. */ #define BOARD_DUMMY_BUTTON BSP_BUTTON_3 /**< Button to press at beginning of the test to indicate that this board is standalone (automatic behavior). */ #define BUTTON_DETECTION_DELAY APP_TIMER_TICKS(50) /**< Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks). */ #define LL_HEADER_LEN 4 /**< Link layer header length. */ #define CONN_CFG_TAG 1 /**< A tag that refers to the BLE stack configuration we set with @ref sd_ble_cfg_set. Default tag is @ref BLE_CONN_CFG_TAG_DEFAULT. */ #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(500) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (0.5 seconds). */ #define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(500) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (0.5 seconds). */ #define MAX_CONN_PARAMS_UPDATE_COUNT 2 /**< Number of attempts before giving up the connection parameter negotiation. */ typedef enum { NOT_SELECTED = 0x00, BOARD_TESTER, BOARD_DUMMY, } board_role_t; typedef struct { uint16_t att_mtu; /**< GATT ATT MTU, in bytes. */ uint16_t conn_interval; /**< Connection interval expressed in units of 1.25 ms. */ bool data_len_ext_enabled; /**< Data length extension status. */ bool conn_evt_len_ext_enabled; /**< Connection event length extension status. */ uint8_t rxtx_phy; /**< Preferred PHY. */ } test_params_t; /**@brief Variable length data encapsulation in terms of length and pointer to data. */ typedef struct { uint8_t * p_data; /**< Pointer to data. */ uint16_t data_len; /**< Length of data. */ } data_t; static nrf_ble_amtc_t m_amtc; static nrf_ble_amts_t m_amts; static board_role_t volatile m_board_role = NOT_SELECTED; static bool volatile m_run_test; static bool volatile m_print_menu; static bool volatile m_notif_enabled; static bool volatile m_mtu_exchanged; static bool volatile m_data_length_updated; #if defined(S140) static bool volatile m_phy_updated; #endif static bool volatile m_conn_interval_configured; static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current BLE connection .*/ static uint8_t m_gap_role = BLE_GAP_ROLE_INVALID; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */ static nrf_ble_gatt_t m_gatt; /**< GATT module instance. */ static ble_db_discovery_t m_ble_db_discovery; /**< DB discovery module instance. */ // Name to use for advertising and connection. static char const m_target_periph_name[] = DEVICE_NAME; // Test parameters. // Settings like ATT MTU size are set only once on the dummy board. // Make sure that defaults are sensible. static test_params_t m_test_params = { .att_mtu = NRF_BLE_GATT_MAX_MTU_SIZE, .conn_interval = CONN_INTERVAL_DEFAULT, .data_len_ext_enabled = true, .conn_evt_len_ext_enabled = true, #if defined(S140) .rxtx_phy = BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_CODED, #endif }; // Scan parameters requested for scanning and connection. static ble_gap_scan_params_t const m_scan_param = { .active = 0x00, .interval = SCAN_INTERVAL, .window = SCAN_WINDOW, .use_whitelist = 0x00, .adv_dir_report = 0x00, .timeout = 0x0000, // No timeout. }; // Connection parameters requested for connection. static ble_gap_conn_params_t m_conn_param = { .min_conn_interval = CONN_INTERVAL_MIN, // Minimum connection interval. .max_conn_interval = CONN_INTERVAL_MAX, // Maximum connection interval. .slave_latency = SLAVE_LATENCY, // Slave latency. .conn_sup_timeout = CONN_SUP_TIMEOUT // Supervisory timeout. }; static void test_terminate(void); #ifdef S140 static uint32_t phy_str(uint8_t phy) { static char const * str[] = { "1 Mbps", "2 Mbps", "Coded", "Unknown" }; switch (phy) { case BLE_GAP_PHY_1MBPS: return (uint32_t)(str[0]); case BLE_GAP_PHY_2MBPS: case BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS: case BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_CODED: return (uint32_t)(str[1]); case BLE_GAP_PHY_CODED: return (uint32_t)(str[2]); default: return (uint32_t)(str[3]); } } #endif /**@brief Parses advertisement data, providing length and location of the field in case * matching data is found. * * @param[in] Type of data to be looked for in advertisement data. * @param[in] Advertisement report length and pointer to report. * @param[out] If data type requested is found in the data report, type data length and * pointer to data will be populated here. * * @retval NRF_SUCCESS if the data type is found in the report. * @retval NRF_ERROR_NOT_FOUND if the data type could not be found. */ static uint32_t adv_report_parse(uint8_t type, data_t * p_advdata, data_t * p_typedata) { uint32_t index = 0; uint8_t * p_data; p_data = p_advdata->p_data; while (index < p_advdata->data_len) { uint8_t field_length = p_data[index]; uint8_t field_type = p_data[index + 1]; if (field_type == type) { p_typedata->p_data = &p_data[index + 2]; p_typedata->data_len = field_length - 1; return NRF_SUCCESS; } index += field_length + 1; } return NRF_ERROR_NOT_FOUND; } /**@brief Function for searching a given name in the advertisement packets. * * @details Use this function to parse received advertising data and to find a given * name in them either as 'complete_local_name' or as 'short_local_name'. * * @param[in] p_adv_report advertising data to parse. * @param[in] name_to_find name to search. * @return true if the given name was found, false otherwise. */ static bool find_adv_name(ble_gap_evt_adv_report_t const * p_adv_report, char const * name_to_find) { ret_code_t err_code; data_t adv_data; data_t dev_name; bool found = false; // Initialize advertisement report for parsing. adv_data.p_data = (uint8_t *)p_adv_report->data; adv_data.data_len = p_adv_report->dlen; // Search for matching advertising names. err_code = adv_report_parse(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME, &adv_data, &dev_name); if ( (err_code == NRF_SUCCESS) && (strlen(name_to_find) == dev_name.data_len) && (memcmp(name_to_find, dev_name.p_data, dev_name.data_len) == 0)) { found = true; } else { // Look for the short local name if the complete name was not found. err_code = adv_report_parse(BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME, &adv_data, &dev_name); if ( (err_code == NRF_SUCCESS) && (strlen(name_to_find) == dev_name.data_len) && (memcmp(m_target_periph_name, dev_name.p_data, dev_name.data_len) == 0)) { found = true; } } return found; } /**@brief Function for handling BLE_GAP_ADV_REPORT events. * Search for a peer with matching device name. * If found, stop advertising and send a connection request to the peer. */ static void on_ble_gap_evt_adv_report(ble_gap_evt_t const * p_gap_evt) { if (!find_adv_name(&p_gap_evt->params.adv_report, m_target_periph_name)) { return; } NRF_LOG_INFO("Device \"%s\" found, sending a connection request.\r\n", (uint32_t) m_target_periph_name); // Stop advertising. (void) sd_ble_gap_adv_stop(); // Initiate connection. m_conn_param.min_conn_interval = CONN_INTERVAL_DEFAULT; m_conn_param.max_conn_interval = CONN_INTERVAL_DEFAULT; ret_code_t err_code; err_code = sd_ble_gap_connect(&p_gap_evt->params.adv_report.peer_addr, &m_scan_param, &m_conn_param, CONN_CFG_TAG); if (err_code != NRF_SUCCESS) { NRF_LOG_ERROR("sd_ble_gap_connect() failed: 0x%x.\r\n", err_code); } } /**@brief Function for handling BLE_GAP_EVT_CONNECTED events. * Save the connection handle and GAP role, then discover the peer DB. */ static void on_ble_gap_evt_connected(ble_gap_evt_t const * p_gap_evt) { m_conn_handle = p_gap_evt->conn_handle; m_gap_role = p_gap_evt->params.connected.role; if (m_gap_role == BLE_GAP_ROLE_PERIPH) { NRF_LOG_INFO("Connected as a peripheral.\r\n"); } else if (m_gap_role == BLE_GAP_ROLE_CENTRAL) { NRF_LOG_INFO("Connected as a central.\r\n"); } // Stop scanning and advertising. (void) sd_ble_gap_scan_stop(); (void) sd_ble_gap_adv_stop(); NRF_LOG_INFO("Discovering GATT database...\r\n"); // Zero the database before starting discovery. memset(&m_ble_db_discovery, 0x00, sizeof(m_ble_db_discovery)); ret_code_t err_code; err_code = ble_db_discovery_start(&m_ble_db_discovery, p_gap_evt->conn_handle); APP_ERROR_CHECK(err_code); #if defined(S140) // Request PHY. ble_gap_phys_t phys = { .tx_phys = m_test_params.rxtx_phy, .rx_phys = m_test_params.rxtx_phy, }; err_code = sd_ble_gap_phy_request(p_gap_evt->conn_handle, &phys); APP_ERROR_CHECK(err_code); #endif bsp_board_leds_off(); } /**@brief Function for handling BLE_GAP_EVT_DISCONNECTED events. * Unset the connection handle and terminate the test. */ static void on_ble_gap_evt_disconnected(ble_gap_evt_t const * p_gap_evt) { m_conn_handle = BLE_CONN_HANDLE_INVALID; NRF_LOG_DEBUG("Disconnected: reason 0x%x.\r\n", p_gap_evt->params.disconnected.reason); if (m_run_test) { NRF_LOG_WARNING("GAP disconnection event received while test was running.\r\n") } bsp_board_leds_off(); test_terminate(); } /**@brief Function for handling BLE Stack events. * * @param[in] p_ble_evt Bluetooth stack event. */ static void on_ble_evt(ble_evt_t * p_ble_evt) { uint32_t err_code; ble_gap_evt_t const * p_gap_evt = &p_ble_evt->evt.gap_evt; switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_ADV_REPORT: on_ble_gap_evt_adv_report(p_gap_evt); break; case BLE_GAP_EVT_CONNECTED: on_ble_gap_evt_connected(p_gap_evt); break; case BLE_GAP_EVT_DISCONNECTED: on_ble_gap_evt_disconnected(p_gap_evt); break; case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: { // Accept parameters requested by the peer. ble_gap_conn_params_t params; params = p_gap_evt->params.conn_param_update_request.conn_params; params.max_conn_interval = params.min_conn_interval; err_code = sd_ble_gap_conn_param_update(p_gap_evt->conn_handle, &params); APP_ERROR_CHECK(err_code); } break; case BLE_GATTS_EVT_SYS_ATTR_MISSING: { err_code = sd_ble_gatts_sys_attr_set(p_gap_evt->conn_handle, NULL, 0, 0); APP_ERROR_CHECK(err_code); } break; case BLE_GATTC_EVT_TIMEOUT: // Fallthrough. case BLE_GATTS_EVT_TIMEOUT: { NRF_LOG_DEBUG("GATT timeout, disconnecting.\r\n"); err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); APP_ERROR_CHECK(err_code); } break; case BLE_EVT_USER_MEM_REQUEST: { err_code = sd_ble_user_mem_reply(p_ble_evt->evt.common_evt.conn_handle, NULL); APP_ERROR_CHECK(err_code); } break; #if defined(S140) case BLE_GAP_EVT_PHY_UPDATE: { ble_gap_evt_phy_update_t * const p_phy_evt = &p_ble_evt->evt.gap_evt.params.phy_update; if (p_phy_evt->status == BLE_HCI_STATUS_CODE_LMP_ERROR_TRANSACTION_COLLISION) { // Ignore LL collisions. NRF_LOG_DEBUG("LL transaction collision during PHY.\r\n"); break; } m_phy_updated = true; NRF_LOG_INFO("PHY update %s. PHY set to %s.\r\n", (p_phy_evt->status == BLE_HCI_STATUS_CODE_SUCCESS) ? (uint32_t)"accepted" : (uint32_t)"rejected", phy_str(p_phy_evt->tx_phy)); } break; #endif default: // No implementation needed. break; } } /**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { on_ble_evt(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt); nrf_ble_gatt_on_ble_evt(&m_gatt, p_ble_evt); nrf_ble_amts_on_ble_evt(&m_amts, p_ble_evt); nrf_ble_amtc_on_ble_evt(&m_amtc, p_ble_evt); } /**@brief Function for handling events from the button handler module. * * @param[in] pin_no The pin that the event applies to. * @param[in] button_action The button action (press/release). */ static void button_evt_handler(uint8_t pin_no, uint8_t button_action) { switch (pin_no) { case BOARD_TESTER_BUTTON: { NRF_LOG_INFO("This board will act as tester.\r\n"); m_board_role = BOARD_TESTER; } break; case BOARD_DUMMY_BUTTON: { NRF_LOG_INFO("This board will act as responder.\r\n"); m_board_role = BOARD_DUMMY; } break; default: break; } } /**@brief AMT Service Handler. */ static void amts_evt_handler(nrf_ble_amts_evt_t evt) { ret_code_t err_code; switch (evt.evt_type) { case NRF_BLE_AMTS_EVT_NOTIF_ENABLED: { NRF_LOG_INFO("Notifications enabled.\r\n"); bsp_board_led_on(READY_LED); m_notif_enabled = true; if (m_board_role != BOARD_TESTER) { return; } if (m_gap_role == BLE_GAP_ROLE_PERIPH) { m_conn_interval_configured = false; m_conn_param.min_conn_interval = m_test_params.conn_interval; m_conn_param.max_conn_interval = m_test_params.conn_interval + 1; err_code = ble_conn_params_change_conn_params(&m_conn_param); if (err_code != NRF_SUCCESS) { NRF_LOG_ERROR("ble_conn_params_change_conn_params() failed: 0x%x.\r\n", err_code); } } if (m_gap_role == BLE_GAP_ROLE_CENTRAL) { m_conn_interval_configured = true; m_conn_param.min_conn_interval = m_test_params.conn_interval; m_conn_param.max_conn_interval = m_test_params.conn_interval; err_code = sd_ble_gap_conn_param_update(m_conn_handle, &m_conn_param); if (err_code != NRF_SUCCESS) { NRF_LOG_ERROR("sd_ble_gap_conn_param_update() failed: 0x%x.\r\n", err_code); } } } break; case NRF_BLE_AMTS_EVT_NOTIF_DISABLED: { NRF_LOG_INFO("Notifications disabled.\r\n"); bsp_board_led_off(READY_LED); } break; case NRF_BLE_AMTS_EVT_TRANSFER_1KB: { NRF_LOG_INFO("Sent %u KBytes\r\n", (evt.bytes_transfered_cnt / 1024)); bsp_board_led_invert(PROGRESS_LED); } break; case NRF_BLE_AMTS_EVT_TRANSFER_FINISHED: { counter_stop(); bsp_board_led_off(PROGRESS_LED); bsp_board_led_on(DONE_LED); uint32_t time_ms = counter_get(); uint32_t bit_count = (evt.bytes_transfered_cnt * 8); float throughput_kbps = ((bit_count / (time_ms / 1000.f)) / 1000.f); NRF_LOG_INFO("Done.\r\n\r\n"); NRF_LOG_INFO("=============================\r\n"); NRF_LOG_INFO("Time: %u.%.2u seconds elapsed.\r\n", (time_ms / 1000), (time_ms % 1000)); NRF_LOG_INFO("Throughput: " NRF_LOG_FLOAT_MARKER " Kbps.\r\n", NRF_LOG_FLOAT(throughput_kbps)); NRF_LOG_INFO("=============================\r\n"); NRF_LOG_INFO("Sent %u bytes of ATT payload.\r\n", evt.bytes_transfered_cnt); NRF_LOG_INFO("Retrieving amount of bytes received from peer...\r\n"); err_code = nrf_ble_amtc_rcb_read(&m_amtc); if (err_code != NRF_SUCCESS) { NRF_LOG_ERROR("nrf_ble_amtc_rcb_read() failed: 0x%x.\r\n", err_code); test_terminate(); } } break; } } /**@brief AMT Client Handler. */ static void amtc_evt_handler(nrf_ble_amtc_t * p_amt_c, nrf_ble_amtc_evt_t * p_evt) { ret_code_t err_code; switch (p_evt->evt_type) { case NRF_BLE_AMT_C_EVT_DISCOVERY_COMPLETE: { NRF_LOG_INFO("AMT service discovered at peer.\r\n"); err_code = nrf_ble_amtc_handles_assign(p_amt_c, p_evt->conn_handle, &p_evt->params.peer_db); APP_ERROR_CHECK(err_code); // Enable notifications. err_code = nrf_ble_amtc_notif_enable(p_amt_c); APP_ERROR_CHECK(err_code); } break; case NRF_BLE_AMT_C_EVT_NOTIFICATION: { static uint32_t bytes_cnt = 0; static uint32_t kbytes_cnt = 0; if (p_evt->params.hvx.bytes_sent == 0) { bytes_cnt = 0; kbytes_cnt = 0; } bytes_cnt += p_evt->params.hvx.notif_len; if (bytes_cnt > 1024) { bsp_board_led_invert(PROGRESS_LED); bytes_cnt -= 1024; kbytes_cnt++; NRF_LOG_INFO("Received %u kbytes\r\n", kbytes_cnt); nrf_ble_amts_rbc_set(&m_amts, p_evt->params.hvx.bytes_rcvd); } if (p_evt->params.hvx.bytes_rcvd >= AMT_BYTE_TRANSFER_CNT) { bsp_board_led_off(PROGRESS_LED); bytes_cnt = 0; kbytes_cnt = 0; NRF_LOG_INFO("Transfer complete, received %u bytes of ATT payload.\r\n", p_evt->params.hvx.bytes_rcvd); nrf_ble_amts_rbc_set(&m_amts, p_evt->params.hvx.bytes_rcvd); } } break; case NRF_BLE_AMT_C_EVT_RBC_READ_RSP: { NRF_LOG_INFO("Peer received %u bytes of ATT payload.\r\n", (p_evt->params.rcv_bytes_cnt)); test_terminate(); } break; default: break; } } /**@brief Function for handling Database Discovery events. * * @details This function is a callback function to handle events from the database discovery module. * Depending on the UUIDs that are discovered, this function should forward the events * to their respective service instances. * * @param[in] p_event Pointer to the database discovery event. */ static void db_disc_evt_handler(ble_db_discovery_evt_t * p_evt) { nrf_ble_amtc_on_db_disc_evt(&m_amtc, p_evt); } /**@brief Function for handling events from the GATT library. */ static void gatt_evt_handler(nrf_ble_gatt_t * p_gatt, nrf_ble_gatt_evt_t const * p_evt) { switch (p_evt->evt_id) { case NRF_BLE_GATT_EVT_ATT_MTU_UPDATED: { m_mtu_exchanged = true; NRF_LOG_INFO("ATT MTU exchange completed. MTU set to %u bytes.\r\n", p_evt->params.att_mtu_effective); } break; case NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED: { m_data_length_updated = true; NRF_LOG_INFO("Data length updated to %u bytes.\r\n", p_evt->params.data_length); } break; } nrf_ble_amts_on_gatt_evt(&m_amts, p_evt); } /**@brief Function for handling a Connection Parameters event. * * @param[in] p_evt event. */ static void conn_params_evt_handler(ble_conn_params_evt_t * p_evt) { if (p_evt->evt_type == BLE_CONN_PARAMS_EVT_SUCCEEDED) { m_conn_interval_configured = true; } } /**@brief Function for handling a Connection Parameters error. * * @param[in] nrf_error Error code containing information about what went wrong. */ static void conn_params_error_handler(uint32_t nrf_error) { APP_ERROR_HANDLER(nrf_error); } /**@brief Function for setting up advertising data. */ static void advertising_data_set(void) { ble_advdata_t const adv_data = { .name_type = BLE_ADVDATA_FULL_NAME, .flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE, .include_appearance = false, }; ret_code_t err_code = ble_advdata_set(&adv_data, NULL); APP_ERROR_CHECK(err_code); } /**@brief Function for starting advertising. */ static void advertising_start(void) { ble_gap_adv_params_t const adv_params = { .type = BLE_GAP_ADV_TYPE_ADV_IND, .p_peer_addr = NULL, .fp = BLE_GAP_ADV_FP_ANY, .interval = ADV_INTERVAL, .timeout = 0, }; NRF_LOG_INFO("Starting advertising.\r\n"); bsp_board_led_on(SCAN_ADV_LED); ret_code_t err_code = sd_ble_gap_adv_start(&adv_params, CONN_CFG_TAG); APP_ERROR_CHECK(err_code); } /**@brief Function to start scanning. */ static void scan_start(void) { NRF_LOG_INFO("Starting scan.\r\n"); bsp_board_led_on(SCAN_ADV_LED); ret_code_t err_code = sd_ble_gap_scan_start(&m_scan_param); APP_ERROR_CHECK(err_code); } static void log_init(void) { ret_code_t err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); } /**@brief Function for the LEDs initialization. * * @details Initializes all LEDs used by the application. */ static void leds_init(void) { bsp_board_leds_init(); } /**@brief Function for the Timer initialization. * * @details Initializes the timer module. This creates and starts application timers. */ static void timer_init(void) { ret_code_t err_code = app_timer_init(); APP_ERROR_CHECK(err_code); } /**@brief Function for initializing the button library. */ static void buttons_init(void) { // The array must be static because a pointer to it will be saved in the button library. static app_button_cfg_t buttons[] = { {BOARD_TESTER_BUTTON, false, BUTTON_PULL, button_evt_handler}, {BOARD_DUMMY_BUTTON, false, BUTTON_PULL, button_evt_handler} }; ret_code_t err_code = app_button_init(buttons, ARRAY_SIZE(buttons), BUTTON_DETECTION_DELAY); APP_ERROR_CHECK(err_code); } /**@brief Function for enabling button input. */ static void buttons_enable(void) { ret_code_t err_code = app_button_enable(); APP_ERROR_CHECK(err_code); } /**@brief Function for disabling button input. */ static void buttons_disable(void) { ret_code_t err_code = app_button_disable(); APP_ERROR_CHECK(err_code); } static void client_init(void) { ret_code_t err_code = ble_db_discovery_init(db_disc_evt_handler); APP_ERROR_CHECK(err_code); err_code = nrf_ble_amtc_init(&m_amtc, amtc_evt_handler); APP_ERROR_CHECK(err_code); } static void server_init(void) { nrf_ble_amts_init(&m_amts, amts_evt_handler); } /**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { ret_code_t err_code; // Initialize the SoftDevice handler library. nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); // Fetch the start address of the application RAM. uint32_t ram_start = 0; err_code = softdevice_app_ram_start_get(&ram_start); APP_ERROR_CHECK(err_code); // Overwrite some of the default configurations for the BLE stack. ble_cfg_t ble_cfg; // Configure the maximum number of connections. memset(&ble_cfg, 0x00, sizeof(ble_cfg)); ble_cfg.gap_cfg.role_count_cfg.periph_role_count = 1; ble_cfg.gap_cfg.role_count_cfg.central_role_count = 1; ble_cfg.gap_cfg.role_count_cfg.central_sec_count = 1; err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Configure the maximum ATT MTU. memset(&ble_cfg, 0x00, sizeof(ble_cfg)); ble_cfg.conn_cfg.conn_cfg_tag = CONN_CFG_TAG; ble_cfg.conn_cfg.params.gatt_conn_cfg.att_mtu = NRF_BLE_GATT_MAX_MTU_SIZE; err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATT, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Configure the maximum event length. memset(&ble_cfg, 0x00, sizeof(ble_cfg)); ble_cfg.conn_cfg.conn_cfg_tag = CONN_CFG_TAG; ble_cfg.conn_cfg.params.gap_conn_cfg.event_length = 320; ble_cfg.conn_cfg.params.gap_conn_cfg.conn_count = BLE_GAP_CONN_COUNT_DEFAULT; err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Configure the number of custom UUIDs. memset(&ble_cfg, 0x00, sizeof(ble_cfg)); ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = 1; err_code = sd_ble_cfg_set(BLE_COMMON_CFG_VS_UUID, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Enable BLE stack. err_code = softdevice_enable(&ram_start); APP_ERROR_CHECK(err_code); // Register a BLE event handler with the SoftDevice handler library. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); } /**@brief Function for initializing GAP parameters. * * @details This function sets up all the necessary GAP (Generic Access Profile) parameters of the * device including the device name and the preferred connection parameters. */ static void gap_params_init(void) { ret_code_t err_code; ble_gap_conn_sec_mode_t sec_mode; BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); err_code = sd_ble_gap_device_name_set(&sec_mode, (uint8_t const *)DEVICE_NAME, strlen(DEVICE_NAME)); APP_ERROR_CHECK(err_code); err_code = sd_ble_gap_ppcp_set(&m_conn_param); APP_ERROR_CHECK(err_code); } /**@brief Function for initializing the GATT library. */ static void gatt_init(void) { ret_code_t err_code = nrf_ble_gatt_init(&m_gatt, gatt_evt_handler); APP_ERROR_CHECK(err_code); } static void wait_for_event(void) { (void) sd_app_evt_wait(); } /**@brief Function for initializing the Connection Parameters module. */ static void conn_params_init(void) { ble_conn_params_init_t const connection_params_init = { .p_conn_params = NULL, .first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY, .next_conn_params_update_delay = NEXT_CONN_PARAMS_UPDATE_DELAY, .max_conn_params_update_count = MAX_CONN_PARAMS_UPDATE_COUNT, .disconnect_on_fail = true, .evt_handler = conn_params_evt_handler, .error_handler = conn_params_error_handler, }; ret_code_t err_code = ble_conn_params_init(&connection_params_init); APP_ERROR_CHECK(err_code); } #ifdef S140 static void preferred_phy_set(uint8_t phy) { ble_opt_t opts; memset(&opts, 0x00, sizeof(ble_opt_t)); opts.gap_opt.preferred_phys.tx_phys = phy; opts.gap_opt.preferred_phys.rx_phys = phy; ret_code_t err_code = sd_ble_opt_set(BLE_GAP_OPT_PREFERRED_PHYS_SET, &opts); APP_ERROR_CHECK(err_code); NRF_LOG_DEBUG("Setting preferred phy (rxtx) to %u: 0x%x\r\n", phy, err_code); } #endif static void gatt_mtu_set(uint16_t att_mtu) { ret_code_t err_code; err_code = nrf_ble_gatt_att_mtu_periph_set(&m_gatt, att_mtu); APP_ERROR_CHECK(err_code); err_code = nrf_ble_gatt_att_mtu_central_set(&m_gatt, att_mtu); APP_ERROR_CHECK(err_code); } static void conn_evt_len_ext_set(bool status) { ret_code_t err_code; ble_opt_t opt; memset(&opt, 0x00, sizeof(opt)); opt.common_opt.conn_evt_ext.enable = status ? 1 : 0; err_code = sd_ble_opt_set(BLE_COMMON_OPT_CONN_EVT_EXT, &opt); APP_ERROR_CHECK(err_code); NRF_LOG_DEBUG("Setting connection event length extension to %u: 0x%x\r\n", status, err_code); } static void data_len_ext_set(bool status) { uint8_t data_length = status ? (247 + LL_HEADER_LEN) : (23 + LL_HEADER_LEN); (void) nrf_ble_gatt_data_length_set(&m_gatt, BLE_CONN_HANDLE_INVALID, data_length); } #if defined(S140) static void preferred_phy_select(void) { NRF_LOG_INFO("Select preferred PHY:\r\n"); NRF_LOG_INFO(" 1) 1 Mbps.\r\n"); NRF_LOG_INFO(" 2) 2 Mbps.\r\n"); NRF_LOG_INFO(" 3) Coded.\r\n"); NRF_LOG_FLUSH(); switch (NRF_LOG_GETCHAR()) { default: case ONE: m_test_params.rxtx_phy = BLE_GAP_PHY_1MBPS; break; case TWO: m_test_params.rxtx_phy = BLE_GAP_PHY_2MBPS; break; case THREE: m_test_params.rxtx_phy = BLE_GAP_PHY_CODED; break; } preferred_phy_set(m_test_params.rxtx_phy); NRF_LOG_INFO("Preferred PHY set to %s.\r\n", phy_str(m_test_params.rxtx_phy)); NRF_LOG_FLUSH(); } #endif static void att_mtu_select(void) { NRF_LOG_INFO("Select an ATT MTU size:\r\n"); NRF_LOG_INFO(" 1) 23 bytes.\r\n"); NRF_LOG_INFO(" 2) 158 bytes.\r\n"); NRF_LOG_INFO(" 3) 247 bytes.\r\n"); NRF_LOG_FLUSH(); switch (NRF_LOG_GETCHAR()) { default: case ONE: m_test_params.att_mtu = 23; break; case TWO: m_test_params.att_mtu = 158; break; case THREE: m_test_params.att_mtu = 247; break; } gatt_mtu_set(m_test_params.att_mtu); NRF_LOG_INFO("ATT MTU set to %u bytes.\r\n", m_test_params.att_mtu); NRF_LOG_FLUSH(); } static void conn_interval_select(void) { NRF_LOG_INFO("Select a connection interval:\r\n"); NRF_LOG_INFO(" 1) 7.5 ms\r\n"); NRF_LOG_INFO(" 2) 50 ms\r\n"); NRF_LOG_INFO(" 3) 400 ms\r\n"); NRF_LOG_FLUSH(); switch (NRF_LOG_GETCHAR()) { default: case ONE: m_test_params.conn_interval = (uint16_t)(MSEC_TO_UNITS(7.5, UNIT_1_25_MS)); NRF_LOG_INFO("Connection interval set to 7.5 ms.\r\n"); break; case TWO: m_test_params.conn_interval = (uint16_t)(MSEC_TO_UNITS(50, UNIT_1_25_MS)); NRF_LOG_INFO("Connection interval set to 50 ms.\r\n"); break; case THREE: m_test_params.conn_interval = (uint16_t)(MSEC_TO_UNITS(400, UNIT_1_25_MS)); NRF_LOG_INFO("Connection interval set to 400 ms.\r\n"); break; } NRF_LOG_FLUSH(); } static void data_len_ext_select(void) { NRF_LOG_INFO("Turn on Data Length Extension? (y/n)\r\n"); NRF_LOG_FLUSH(); char answer = NRF_LOG_GETCHAR(); m_test_params.data_len_ext_enabled = (answer == YES) ? 1 : 0; data_len_ext_set(m_test_params.data_len_ext_enabled); NRF_LOG_INFO("Data Length Extension is %s\r\n", (answer == YES) ? (uint32_t) "ON" : (uint32_t) "OFF"); NRF_LOG_FLUSH(); } static void test_param_adjust(void) { bool done = false; while (!done) { NRF_LOG_RAW_INFO("\r\n"); NRF_LOG_INFO("Adjust test parameters:\r\n"); NRF_LOG_INFO(" 1) Select ATT MTU size.\r\n"); NRF_LOG_INFO(" 2) Select connection interval.\r\n"); NRF_LOG_INFO(" 3) Turn on/off Data length extension (DLE).\r\n"); #if defined(S140) NRF_LOG_INFO(" 4) Select preferred PHY.\r\n") #endif NRF_LOG_RAW_INFO("\r\n"); NRF_LOG_INFO("Press ENTER when finished.\r\n"); NRF_LOG_RAW_INFO("\r\n"); NRF_LOG_FLUSH(); switch (NRF_LOG_GETCHAR()) { case ONE: att_mtu_select(); break; case TWO: conn_interval_select(); break; case THREE: data_len_ext_select(); break; #if defined(S140) case FOUR: preferred_phy_select(); break; #endif default: case ENTER: done = true; break; } } } static void test_params_print(void) { NRF_LOG_RAW_INFO("\r\n"); NRF_LOG_INFO("Current test configuration:\r\n"); NRF_LOG_INFO("===============================\r\n"); NRF_LOG_INFO("ATT MTU size: %u\r\n", m_test_params.att_mtu); NRF_LOG_INFO("Conn. interval: %u units (1.25 ms per unit).\r\n", m_test_params.conn_interval); NRF_LOG_INFO("Data length extension (DLE): %s\r\n", m_test_params.data_len_ext_enabled ? (uint32_t)"ON" : (uint32_t)"OFF"); NRF_LOG_DEBUG("Conn. event length ext.: %s\r\n", m_test_params.conn_evt_len_ext_enabled ? (uint32_t)"ON" : (uint32_t)"OFF"); #if defined(S140) NRF_LOG_INFO("Preferredy PHY: %s\r\n", phy_str(m_test_params.rxtx_phy)); #endif NRF_LOG_INFO("===============================\r\n"); NRF_LOG_RAW_INFO("\r\n"); NRF_LOG_FLUSH(); } static void test_begin(void) { NRF_LOG_INFO("Preparing the test.\r\n"); NRF_LOG_FLUSH(); switch (m_gap_role) { default: // If no connection was established, the role won't be either. // In this case, start both advertising and scanning. advertising_start(); scan_start(); break; case BLE_GAP_ROLE_PERIPH: advertising_start(); break; case BLE_GAP_ROLE_CENTRAL: scan_start(); break; } } static void test_run(void) { NRF_LOG_RAW_INFO("\r\n"); NRF_LOG_INFO("Test is ready. Press any key to run.\r\n"); NRF_LOG_FLUSH(); (void) NRF_LOG_GETCHAR(); counter_start(); nrf_ble_amts_notif_spam(&m_amts); } static void test_terminate(void) { m_run_test = false; m_notif_enabled = false; m_mtu_exchanged = false; m_data_length_updated = false; #if defined(S140) m_phy_updated = false; #endif m_conn_interval_configured = false; if (m_conn_handle != BLE_CONN_HANDLE_INVALID) { NRF_LOG_INFO("Disconnecting...\r\n"); ret_code_t err_code; err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); if (err_code != NRF_SUCCESS) { NRF_LOG_ERROR("sd_ble_gap_disconnect() failed: 0x%0x.\r\n", err_code); } } else { if (m_board_role == BOARD_TESTER) { m_print_menu = true; } if (m_board_role == BOARD_DUMMY) { if (m_gap_role == BLE_GAP_ROLE_PERIPH) { advertising_start(); } else { scan_start(); } } } } static void menu_print(void) { bool begin_test = false; while (!begin_test) { test_params_print(); NRF_LOG_INFO("Throughput example:\r\n"); NRF_LOG_INFO(" 1) Run test.\r\n"); NRF_LOG_INFO(" 2) Adjust test parameters.\r\n"); NRF_LOG_FLUSH(); switch (NRF_LOG_GETCHAR()) { case ONE: default: begin_test = true; test_begin(); break; case TWO: test_param_adjust(); break; } } m_print_menu = false; } static bool is_test_ready() { return ( (m_board_role == BOARD_TESTER) && m_conn_interval_configured && m_notif_enabled && m_mtu_exchanged && m_data_length_updated #if defined(S140) && m_phy_updated #endif && !m_run_test); } static void board_role_select(void) { buttons_enable(); while (m_board_role == NOT_SELECTED) { wait_for_event(); } buttons_disable(); } int main(void) { log_init(); leds_init(); timer_init(); counter_init(); buttons_init(); ble_stack_init(); gap_params_init(); conn_params_init(); gatt_init(); advertising_data_set(); server_init(); client_init(); gatt_mtu_set(m_test_params.att_mtu); data_len_ext_set(m_test_params.data_len_ext_enabled); conn_evt_len_ext_set(m_test_params.conn_evt_len_ext_enabled); #if defined(S140) preferred_phy_set(m_test_params.rxtx_phy); #endif NRF_LOG_INFO("ATT MTU example started.\r\n"); NRF_LOG_INFO("Press button 3 on the board connected to the PC.\r\n"); NRF_LOG_INFO("Press button 4 on other board.\r\n"); NRF_LOG_FLUSH(); board_role_select(); if (m_board_role == BOARD_TESTER) { m_print_menu = true; } if (m_board_role == BOARD_DUMMY) { advertising_start(); scan_start(); } // Enter main loop. NRF_LOG_DEBUG("Entering main loop.\r\n"); for (;;) { if (m_print_menu) { menu_print(); } if (is_test_ready()) { m_run_test = true; test_run(); } if (!NRF_LOG_PROCESS()) { wait_for_event(); } } } /** * @} */
opplatek/deSALT
src/deBGA-master/seed_ali_core.c
#include <time.h> #include <ctype.h> #include <inttypes.h> #include <omp.h> #include <math.h> //#include "global.h" #include "binarys_qsort.h" #include "LandauVishkin.h" #include "seed_ali_p.h" #include "bit_operation.h" #include "ksw.h" #ifdef PTHREAD_USE #include <pthread.h> #ifdef R_W_LOCK static void *worker(void *data) { thread_ali_t *d = (thread_ali_t*)data; int _read_seq; while (1) { pthread_rwlock_wrlock(&rwlock); _read_seq = read_seq++; pthread_rwlock_unlock(&rwlock); if (_read_seq < d->seqn) { seed_ali_core(_read_seq, d->tid); } else break; } return 0; } static void *worker_single_end(void *data) { thread_ali_t *d = (thread_ali_t*)data; int _read_seq; while (1) { pthread_rwlock_wrlock(&rwlock); _read_seq = read_seq++; pthread_rwlock_unlock(&rwlock); if (_read_seq < d->seqn) { seed_ali_core_single_end(_read_seq, d->tid); } else break; } return 0; } #else static void *worker(void *data) { thread_ali_t *d = (thread_ali_t*)data; seed_ali_core(d->seqn, d->tid); return 0; } static void *worker_single_end(void *data) { thread_ali_t *d = (thread_ali_t*)data; seed_ali_core_single_end(d->seqn, d->tid); return 0; } #endif #endif int seed_ali() { fprintf(stderr, "pair end reads mapping\n\n"); double t = 0.00; clock_t start = 0, end = 0; uint8_t readlen_name = 200; uint16_t v_cnt_i = 0; //uint16_t read_bit_char = 0; uint32_t r_i = 0; uint32_t seqi = 0; uint32_t seqii = 0; uint32_t read_in = 0X10000; int32_t l, m, k1;//maybe changed here int64_t kr1 = 1; int64_t kr2 = 1; char h_chars[6]; #ifdef PAIR_RANDOM_SEED uint32_t r_dup_i = 0; uint32_t pos_r_ir = 0; int pos_r_nr = 0; #endif start = clock(); load_index_file(); end = clock(); t = (double)(end - start) / CLOCKS_PER_SEC; fp1 = gzopen(read_fastq1, "r"); seq1 = kseq_init(fp1); fp2 = gzopen(read_fastq2, "r"); seq2 = kseq_init(fp2); if((fp1 == NULL) || (fp2 == NULL)) { fprintf(stderr, "wrong input file route or name: %s %s\n", read_fastq1, read_fastq2); exit(1); } if(flag_std == 0) { fp_sam = fopen(sam_result, "w"); if(fp_sam == NULL) { fprintf(stderr, "wrong output file route or name: %s\n", sam_result); exit(1); } } seed_l_max = seed_step * cir_fix_n; insert_dis = (upper_ins + floor_ins) >> 1; devi = (upper_ins - floor_ins) >> 1; pair_ran_intvp = seed_l_max; #ifdef SEED_FILTER_POS seed_filter_pos_num = seed_filter_pos_numn >> 2; #endif //fprintf(stderr, "number of threads: %u\nkmer size: %u\ninsert size: %u\nstandard varaiance: %"PRId64"\nseed interval: %u\nthe max read length: %u\nmax lv error rate: %.2f\nmax pair error rate: %.2f\nthe minimum seed interval: %u\nthe number of seed circulation: %u\nlv rate on anchor: %.2f\nthe max rate of mismatch alignment on anchor: %.2f\n", thread_n, k_t, insert_dis, (devi / 3), pair_ran_intvp, readlen_max, lv_rate, max_pair_score_r, seed_step, cir_fix_n, lv_rate_anchor, mis_match_r_single); fprintf(stderr, "number of threads: %u\nkmer size: %u\nseed interval: %u\nthe max read length: %u\nmax lv error rate: %.2f\nmax pair error rate: %.2f\nthe minimum seed interval: %u\nthe number of seed circulation: %u\nlv rate on anchor: %.2f\nthe max rate of mismatch alignment on anchor: %.2f\n", thread_n, k_t, pair_ran_intvp, readlen_max, lv_rate, max_pair_score_r, seed_step, cir_fix_n, lv_rate_anchor, mis_match_r_single); fprintf(stderr, "local alignment score match: %d mismatch: %d gap open: %d gap extension: %d\n", mat_score, mis_score, gapo_score, gape_score); fprintf(stderr, "%lf seconds is used for loading index\n", t); if(local_ksw) fprintf(stderr, "use local sw alignment\n"); if(last_circle_rate) fprintf(stderr, "use last circle end-to-end alignment and the max rate of alignment score is %.2f\n", last_circle_rate); if(!mgn_flag) fprintf(stderr, "use the mode of multi-genomes\n"); #ifdef LV_MP fprintf(stderr, "cal mapping quality on LV\n"); #endif #ifdef QUAL_ANCHOR fprintf(stderr, "use quality in anchor\n"); #endif if(flag_std) fprintf(stderr, "output alignments by stdout\n"); k_r = k_t - k; re_b = 32 - k_t; re_bt = (re_b << 1); re_2bt = 64 - k_t; //should allocate at beginning seed_num = ((readlen_max - k_t) / seed_l_l) + 1; new_seed_cnt = seed_num * pos_n_max; uint16_t cigar_max_n = MAX_LV_CIGARCOM; #ifdef STA_SEED fp_read = fopen(file_read, "w"); fp_seed = fopen(file_seed, "w"); #endif //allocation start = clock(); #ifdef PTHREAD_USE #ifdef ANCHOR_HASH_ALI anchor_hash = (uint16_t*** )calloc(thread_n, sizeof(uint16_t** )); for(r_i = 0; r_i < thread_n; r_i++) { anchor_hash[r_i] = (uint16_t** )calloc(4, sizeof(uint16_t* )); for(m = 0; m < 4; m++) anchor_hash[r_i][m] = (uint16_t* )calloc(1 << 16, 2); } anchor_array = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { anchor_array[r_i] = (uint8_t** )calloc(4, sizeof(uint8_t* )); for(m = 0; m < 4; m++) anchor_array[r_i][m] = (uint8_t* )calloc(readlen_max - k_anchor + 1, 1); } anchor_point = (uint16_t*** )calloc(thread_n, sizeof(uint16_t** )); for(r_i = 0; r_i < thread_n; r_i++) { anchor_point[r_i] = (uint16_t** )calloc(4, sizeof(uint16_t* )); for(m = 0; m < 4; m++) anchor_point[r_i][m] = (uint16_t* )calloc(readlen_max - k_anchor + 1, 2); } anchor_pos = (uint16_t*** )calloc(thread_n, sizeof(uint16_t** )); for(r_i = 0; r_i < thread_n; r_i++) { anchor_pos[r_i] = (uint16_t** )calloc(4, sizeof(uint16_t* )); for(m = 0; m < 4; m++) anchor_pos[r_i][m] = (uint16_t* )calloc(readlen_max - k_anchor + 1, 2); } rh = (read_h** )calloc(thread_n, sizeof(read_h* )); for(r_i = 0; r_i < thread_n; r_i++) rh[r_i] = (read_h* )calloc(readlen_max - k_anchor + 1, sizeof(read_h)); anchor_seed_buffer = (anchor_seed** )calloc(thread_n, sizeof(anchor_seed* )); for(r_i = 0; r_i < thread_n; r_i++) anchor_seed_buffer[r_i] = (anchor_seed* )calloc((readlen_max - k_anchor + 1) * insert_dis, sizeof(anchor_seed)); #endif g_low = (int64_t* )calloc(thread_n, 8); r_low = (int64_t* )calloc(thread_n, 8); seedm = (seed_m** )calloc(thread_n, sizeof(seed_m* )); for(r_i = 0; r_i < thread_n; r_i++) seedm[r_i] = (seed_m* )calloc(seed_num, sizeof(seed_m)); seedu = (seed_m** )calloc(thread_n, sizeof(seed_m* )); for(r_i = 0; r_i < thread_n; r_i++) seedu[r_i] = (seed_m* )calloc(seed_num, sizeof(seed_m)); seedsets = (seed_sets** )calloc(thread_n, sizeof(seed_sets* )); for(r_i = 0; r_i < thread_n; r_i++) seedsets[r_i] = (seed_sets* )calloc(new_seed_cnt, sizeof(seed_sets)); seed_set_off = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_off[r_i] = (uint32_t* )calloc(new_seed_cnt, sizeof(uint32_t )); #ifdef UNPIPATH_OFF_K20 seed_set_pos[0][0] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[0][0][r_i] = (uint64_t* )calloc(new_seed_cnt, 8); seed_set_pos[0][1] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[0][1][r_i] = (uint64_t* )calloc(new_seed_cnt, 8); seed_set_pos[1][0] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[1][0][r_i] = (uint64_t* )calloc(new_seed_cnt, 8); seed_set_pos[1][1] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[1][1][r_i] = (uint64_t* )calloc(new_seed_cnt, 8); #else seed_set_pos[0][0] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[0][0][r_i] = (uint32_t* )calloc(new_seed_cnt, 4); seed_set_pos[0][1] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[0][1][r_i] = (uint32_t* )calloc(new_seed_cnt, 4); seed_set_pos[1][0] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[1][0][r_i] = (uint32_t* )calloc(new_seed_cnt, 4); seed_set_pos[1][1] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos[1][1][r_i] = (uint32_t* )calloc(new_seed_cnt, 4); #endif seedpa1[0] = (seed_pa** )calloc(thread_n, sizeof(seed_pa* )); for(r_i = 0; r_i < thread_n; r_i++) seedpa1[0][r_i] = (seed_pa* )calloc(new_seed_cnt, sizeof(seed_pa )); seedpa1[1] = (seed_pa** )calloc(thread_n, sizeof(seed_pa* )); for(r_i = 0; r_i < thread_n; r_i++) seedpa1[1][r_i] = (seed_pa* )calloc(new_seed_cnt, sizeof(seed_pa )); seedpa2[0] = (seed_pa** )calloc(thread_n, sizeof(seed_pa* )); for(r_i = 0; r_i < thread_n; r_i++) seedpa2[0][r_i] = (seed_pa* )calloc(new_seed_cnt, sizeof(seed_pa )); seedpa2[1] = (seed_pa** )calloc(thread_n, sizeof(seed_pa* )); for(r_i = 0; r_i < thread_n; r_i++) seedpa2[1][r_i] = (seed_pa* )calloc(new_seed_cnt, sizeof(seed_pa )); fprintf(stderr, "Load seed reduction allocation\n"); #ifdef ALTER_DEBUG seed_length_arr = (seed_length_array** )calloc(thread_n, sizeof(seed_length_array* )); for(r_i = 0; r_i < thread_n; r_i++) seed_length_arr[r_i] = (seed_length_array* )calloc(cus_max_output_ali, sizeof(seed_length_array)); rep_go = (uint8_t* )calloc(thread_n, 1); #endif #ifdef UNPIPATH_OFF_K20 #ifdef REDUCE_ANCHOR poses1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) poses1[r_i] = (uint64_t* )calloc(cus_max_output_ali << 1, 8); poses2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) poses2[r_i] = (uint64_t* )calloc(cus_max_output_ali << 1, 8); #endif op_vector_pos1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_vector_pos1[r_i] = (uint64_t* )calloc(cus_max_output_ali, 8); op_vector_pos2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_vector_pos2[r_i] = (uint64_t* )calloc(cus_max_output_ali, 8); ops_vector_pos1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_vector_pos1[r_i] = (uint64_t* )calloc(cus_max_output_ali, 8); ops_vector_pos2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_vector_pos2[r_i] = (uint64_t* )calloc(cus_max_output_ali, 8); #else #ifdef REDUCE_ANCHOR poses1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) poses1[r_i] = (uint32_t* )calloc(cus_max_output_ali << 1, 4); poses2 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) poses2[r_i] = (uint32_t* )calloc(cus_max_output_ali << 1, 4); #endif op_vector_pos1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_vector_pos1[r_i] = (uint32_t* )calloc(cus_max_output_ali, 4); op_vector_pos2 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_vector_pos2[r_i] = (uint32_t* )calloc(cus_max_output_ali, 4); ops_vector_pos1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_vector_pos1[r_i] = (uint32_t* )calloc(cus_max_output_ali, 4); ops_vector_pos2 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_vector_pos2[r_i] = (uint32_t* )calloc(cus_max_output_ali, 4); #endif #ifdef REDUCE_ANCHOR ls1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ls1[r_i] = (int* )calloc(cus_max_output_ali << 1, 4); rs1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) rs1[r_i] = (int* )calloc(cus_max_output_ali << 1, 4); ls2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ls2[r_i] = (int* )calloc(cus_max_output_ali << 1, 4); rs2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) rs2[r_i] = (int* )calloc(cus_max_output_ali << 1, 4); #endif op_dm_l1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_l1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_r1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_r1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_l2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_l2[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_r2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_r2[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_l1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_l1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_r1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_r1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_l2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_l2[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_r2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_r2[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_ex1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_ex1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_ex2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_ex2[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_ex1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_ex1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_ex2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_ex2[r_i] = (int* )calloc(cus_max_output_ali, 4); //for S #ifdef QUALS_CHECK op_err = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_err[r_i] = (uint8_t* )calloc(cus_max_output_ali, 1); ops_err = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_err[r_i] = (uint8_t* )calloc(cus_max_output_ali, 1); #endif op_vector_seq1 = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) { op_vector_seq1[r_i] = (uint64_t** )calloc(cus_max_output_ali, sizeof(uint64_t* )); for(m = 0; m < cus_max_output_ali; m++) if((op_vector_seq1[r_i][m] = (uint64_t* )calloc(MAX_REF_SEQ_C, 8)) == NULL) exit(1); } op_vector_seq2 = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) { op_vector_seq2[r_i] = (uint64_t** )calloc(cus_max_output_ali, sizeof(uint64_t* )); for(m = 0; m < cus_max_output_ali; m++) if((op_vector_seq2[r_i][m] = (uint64_t* )calloc(MAX_REF_SEQ_C, 8)) == NULL) exit(1); } ops_vector_seq1 = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) { ops_vector_seq1[r_i] = (uint64_t** )calloc(cus_max_output_ali, sizeof(uint64_t* )); for(m = 0; m < cus_max_output_ali; m++) if((ops_vector_seq1[r_i][m] = (uint64_t* )calloc(MAX_REF_SEQ_C, 8)) == NULL) exit(1); } ops_vector_seq2 = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) { ops_vector_seq2[r_i] = (uint64_t** )calloc(cus_max_output_ali, sizeof(uint64_t* )); for(m = 0; m < cus_max_output_ali; m++) if((ops_vector_seq2[r_i][m] = (uint64_t* )calloc(MAX_REF_SEQ_C, 8)) == NULL) exit(1); } fprintf(stderr, "Load alignment allocation\n"); #ifdef ALT_ALL chr_res = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) chr_res[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); sam_pos1s = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) if((sam_pos1s[r_i] = (uint32_t* )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(uint32_t ))) == NULL) exit(1); sam_pos2s = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) if((sam_pos2s[r_i] = (uint32_t* )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(uint32_t ))) == NULL) exit(1); cigar_p1s = (char*** )calloc(thread_n, sizeof(char** )); for(r_i = 0; r_i < thread_n; r_i++) { cigar_p1s[r_i] = (char** )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(char* )); for(m = 0; m < CUS_MAX_OUTPUT_ALI2; m++) if((cigar_p1s[r_i][m] = (char* )calloc(cigar_max_n, 1)) == NULL) exit(1); } cigar_p2s = (char*** )calloc(thread_n, sizeof(char** )); for(r_i = 0; r_i < thread_n; r_i++) { cigar_p2s[r_i] = (char** )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(char* )); for(m = 0; m < CUS_MAX_OUTPUT_ALI2; m++) if((cigar_p2s[r_i][m] = (char* )calloc(cigar_max_n, 1)) == NULL) exit(1); } xa_d1s = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) xa_d1s[r_i] = (char* )calloc(CUS_MAX_OUTPUT_ALI2, 1); xa_d2s = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) xa_d2s[r_i] = (char* )calloc(CUS_MAX_OUTPUT_ALI2, 1); lv_re1s = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) lv_re1s[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(int)); lv_re2s = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) lv_re2s[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(int)); #endif fprintf(stderr, "Load output allocation\n"); #ifdef REDUCE_ANCHOR rcs1 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) rcs1[r_i] = (uint8_t* )calloc(cus_max_output_ali << 1, 1); rcs2 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) rcs2[r_i] = (uint8_t* )calloc(cus_max_output_ali << 1, 1); #endif op_rc = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_rc[r_i] = (uint8_t* )calloc(cus_max_output_ali, 1); ops_rc = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_rc[r_i] = (uint8_t* )calloc(cus_max_output_ali, 1); ref_seq_tmp1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ref_seq_tmp1[r_i] = (uint64_t* )calloc(MAX_REF_SEQ_C, 8); ref_seq_tmp2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ref_seq_tmp2[r_i] = (uint64_t* )calloc(MAX_REF_SEQ_C, 8); #ifdef UNPIPATH_OFF_K20 mat_pos1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) mat_pos1[r_i] = (uint64_t* )calloc(CUS_SEED_SET, 8); mat_pos2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) mat_pos2[r_i] = (uint64_t* )calloc(CUS_SEED_SET, 8); #else mat_pos1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) mat_pos1[r_i] = (uint32_t* )calloc(CUS_SEED_SET, 4); mat_pos2 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) mat_pos2[r_i] = (uint32_t* )calloc(CUS_SEED_SET, 4); #endif mat_rc = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) mat_rc[r_i] = (uint8_t* )calloc(CUS_SEED_SET, 1); seed_no1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_no1[r_i] = (uint32_t* )calloc(CUS_SEED_SET, 4); seed_no2 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_no2[r_i] = (uint32_t* )calloc(CUS_SEED_SET, 4); fprintf(stderr, "Load alignment more allocation\n"); #ifdef PAIR_RANDOM #ifdef UNPIPATH_OFF_K20 seedpos[0][0] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[0][0][r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); seedpos[0][1] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[0][1][r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); seedpos[1][0] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[1][0][r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); seedpos[1][1] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[1][1][r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); seed_single_pos[0] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_pos[0][r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); seed_single_pos[1] = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_pos[1][r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); seed_k_pos = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) //2000 { seed_k_pos[r_i] = (uint64_t** )calloc(readlen_max / pair_ran_intvp, sizeof(uint64_t* )); for(m = 0; m < readlen_max / pair_ran_intvp; m++) if((seed_k_pos[r_i][m] = (uint64_t* )calloc(RANDOM_RANGE, 8)) == NULL) exit(1); } seedposk = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedposk[r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 8); #else seedpos[0][0] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[0][0][r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seedpos[0][1] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[0][1][r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seedpos[1][0] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[1][0][r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seedpos[1][1] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos[1][1][r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_pos[0] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_pos[0][r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_pos[1] = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_pos[1][r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_k_pos = (uint32_t*** )calloc(thread_n, sizeof(uint32_t** )); for(r_i = 0; r_i < thread_n; r_i++) //2000 { seed_k_pos[r_i] = (uint32_t** )calloc(readlen_max / pair_ran_intvp, sizeof(uint32_t* )); for(m = 0; m < readlen_max / pair_ran_intvp; m++) if((seed_k_pos[r_i][m] = (uint32_t* )calloc(RANDOM_RANGE, 4)) == NULL) exit(1); } seedposk = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedposk[r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); #endif seed_posf[0] = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_posf[0][r_i] = (uint8_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 1); seed_posf[1] = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_posf[1][r_i] = (uint8_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 1); seed_single_ld[0] = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_ld[0][r_i] = (int* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_ld[1] = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_ld[1][r_i] = (int* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_rd[0] = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_rd[0][r_i] = (int* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_rd[1] = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_rd[1][r_i] = (int* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_dm[0] = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_dm[0][r_i] = (int* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); seed_single_dm[1] = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) seed_single_dm[1][r_i] = (int* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 4); if((seed_single_refs[0] = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** ))) == NULL) exit(1); for(r_i = 0; r_i < thread_n; r_i++) { if((seed_single_refs[0][r_i] = (uint64_t** )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, sizeof(uint64_t* ))) == NULL) exit(1); for(m = 0; m < (readlen_max / pair_ran_intvp) * RANDOM_RANGE; m++) { if((seed_single_refs[0][r_i][m] = (uint64_t* )calloc((((readlen_max - 1) >> 5) + 3), 8)) == NULL) exit(1); } } if((seed_single_refs[1] = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** ))) == NULL) exit(1); for(r_i = 0; r_i < thread_n; r_i++) { if((seed_single_refs[1][r_i] = (uint64_t** )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, sizeof(uint64_t* ))) == NULL) exit(1); for(m = 0; m < (readlen_max / pair_ran_intvp) * RANDOM_RANGE; m++) { if((seed_single_refs[1][r_i][m] = (uint64_t* )calloc((((readlen_max - 1) >> 5) + 3), 8)) == NULL) exit(1); } } #ifdef PR_SINGLE seedpos_mis[0][0] = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos_mis[0][0][r_i] = (uint8_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 1); seedpos_mis[0][1] = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos_mis[0][1][r_i] = (uint8_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 1); seedpos_mis[1][0] = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos_mis[1][0][r_i] = (uint8_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 1); seedpos_mis[1][1] = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) seedpos_mis[1][1][r_i] = (uint8_t* )calloc((readlen_max / pair_ran_intvp) * RANDOM_RANGE, 1); pr_chr_res1 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) pr_chr_res1[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); pr_sam_pos1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) pr_sam_pos1[r_i] = (uint32_t* )calloc(pr_single_outputn, 4); pr_xa_d1 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) pr_xa_d1[r_i] = (char* )calloc(pr_single_outputn, 1); pr_lv_re1 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) pr_lv_re1[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); pr_chr_res2 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) pr_chr_res2[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); pr_sam_pos2 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) pr_sam_pos2[r_i] = (uint32_t* )calloc(pr_single_outputn, 4); pr_xa_d2 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) pr_xa_d2[r_i] = (char* )calloc(pr_single_outputn, 1); pr_lv_re2 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) pr_lv_re2[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); #endif fprintf(stderr, "Load pair random allocation\n"); #ifdef PAIR_RANDOM_SEED seed_r_dup = (uint32_t* )calloc(RANDOM_RANGE, 4); srand((unsigned)time(0)); pos_r_nr = RANDOM_RANGE; r_dup_i = 0; for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE_MAX; pos_r_ir++) if((rand() % (RANDOM_RANGE_MAX - pos_r_ir)) < pos_r_nr) { seed_r_dup[r_dup_i++] = pos_r_ir; pos_r_nr--; } random_buffer = (uint32_t* )malloc((RAN_CIR) << 2); for(pos_r_ir = 0; pos_r_ir < RAN_CIR; pos_r_ir++) random_buffer[pos_r_ir] = (uint32_t )rand(); #endif #endif #ifdef READN_RANDOM_SEED random_buffer_readn = (uint32_t* )calloc(RANDOM_RANGE_READN, 4); for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE_READN; pos_r_ir++) random_buffer_readn[pos_r_ir] = (uint32_t )rand(); #endif //thread gloabl value rc_cov_f = (uint8_t* )calloc(thread_n, 1); cov_a_n = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) cov_a_n[r_i] = (uint8_t* )calloc(2,1); cov_a_n_s = (uint8_t* )calloc(thread_n, 1); s_uid_f = (uint8_t* )calloc(thread_n, 1); min_mis = (uint8_t* )calloc(thread_n, 1); de_m_p = (uint8_t* )calloc(thread_n, 1); de_m_p_o = (uint8_t* )calloc(thread_n, 1); seed_l = (int16_t* )calloc(thread_n, 2);//cannot be 0 max_mismatch1 = (uint16_t* )calloc(thread_n, 2); max_mismatch2 = (uint16_t* )calloc(thread_n, 2); max_mismatch1_single = (uint16_t* )calloc(thread_n, 2); max_mismatch2_single = (uint16_t* )calloc(thread_n, 2); #ifdef PR_SINGLE pr_o_f = (uint8_t* )calloc(thread_n, 1); seed_re_r = (uint8_t* )calloc(thread_n, 1); #endif end_dis1 = (uint16_t* )calloc(thread_n, 2); end_dis2 = (uint16_t* )calloc(thread_n, 2); mat_posi = (uint32_t* )calloc(thread_n, 4); #ifdef PAIR_SEED_LENGTH_FILT max_lengtht = (uint32_t* )calloc(thread_n, 4); #endif #ifdef REDUCE_ANCHOR orders1 = (uint16_t** )calloc(thread_n, sizeof(uint16_t* )); for(r_i = 0; r_i < thread_n; r_i++) orders1[r_i] = (uint16_t* )calloc(cus_max_output_ali << 1, 2); orders2 = (uint16_t** )calloc(thread_n, sizeof(uint16_t* )); for(r_i = 0; r_i < thread_n; r_i++) orders2[r_i] = (uint16_t* )calloc(cus_max_output_ali << 1, 2); dms1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) dms1[r_i] = (int* )calloc(cus_max_output_ali << 1, 4); dms2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) dms2[r_i] = (int* )calloc(cus_max_output_ali << 1, 4); #endif dm_op = (int* )calloc(thread_n, 4); dm_ops = (int* )calloc(thread_n, 4); low_mask1 = (uint64_t* )calloc(thread_n, 8); low_mask2 = (uint64_t* )calloc(thread_n, 8); pos_add = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) pos_add[r_i] = (uint8_t* )calloc(pos_n_max, 1); cigar_m1 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) cigar_m1[r_i] = (char* )calloc(CIGARMN, 1); cigar_m2 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) cigar_m2[r_i] = (char* )calloc(CIGARMN, 1); ali_ref_seq = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) ali_ref_seq[r_i] = (char* )calloc(readlen_max + 64, 1); read_char = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) read_char[r_i] = (char* )calloc(readlen_max + 32, 1); pos_ren[0][0] = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); pos_ren[0][1] = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); pos_ren[1][0] = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); pos_ren[1][1] = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); sub_mask1 = (uint16_t** )calloc(thread_n, sizeof(uint16_t* )); for(r_i = 0; r_i < thread_n; r_i++) sub_mask1[r_i] = (uint16_t* )calloc(33, 2); sub_mask2 = (uint16_t** )calloc(thread_n, sizeof(uint16_t* )); for(r_i = 0; r_i < thread_n; r_i++) sub_mask2[r_i] = (uint16_t* )calloc(33, 2); seedpos_misn[0][0] = (uint32_t* )calloc(thread_n, sizeof(uint32_t )); seedpos_misn[0][1] = (uint32_t* )calloc(thread_n, sizeof(uint32_t )); seedpos_misn[1][0] = (uint32_t* )calloc(thread_n, sizeof(uint32_t )); seedpos_misn[1][1] = (uint32_t* )calloc(thread_n, sizeof(uint32_t )); ex_d_mask1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ex_d_mask1[r_i] = (uint64_t* )calloc(33, 8); ex_d_mask2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ex_d_mask2[r_i] = (uint64_t* )calloc(33, 8); #ifdef PAIR_RANDOM #ifdef UNPIPATH_OFF_K20 b = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) b[r_i] = (uint64_t* )calloc((readlen_max / pair_ran_intvp) + 1, 8); #else b = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) b[r_i] = (uint32_t* )calloc((readlen_max / pair_ran_intvp) + 1, 4); #endif ls = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) ls[r_i] = (uint32_t* )calloc(readlen_max / pair_ran_intvp, 4); read_bit_pr = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) read_bit_pr[r_i] = (uint64_t** )calloc(4, sizeof(uint64_t* )); read_val_pr = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) read_val_pr[r_i] = (uint8_t** )calloc(4, sizeof(uint8_t* )); kcol = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) kcol[r_i] = (uint32_t* )calloc(readlen_max / pair_ran_intvp, 4); seed_posn[0] = (uint32_t* )calloc(thread_n, 4); seed_posn[1] = (uint32_t* )calloc(thread_n, 4); seedn = (uint16_t* )calloc(thread_n, 2); #endif read_bit_1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); read_bit_2 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); read_val_1 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); read_val_2 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); read_val1 = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { read_val1[r_i] = (uint8_t** )calloc(2, sizeof(uint8_t* )); read_val1[r_i][0] = (uint8_t* )calloc(readlen_max, 1); read_val1[r_i][1] = (uint8_t* )calloc(readlen_max, 1); } read_val2 = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { read_val2[r_i] = (uint8_t** )calloc(2, sizeof(uint8_t* )); read_val2[r_i][0] = (uint8_t* )calloc(readlen_max, 1); read_val2[r_i][1] = (uint8_t* )calloc(readlen_max, 1); } #ifdef QUAL_FILT_LV qual_filt_lv1 = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { qual_filt_lv1[r_i] = (uint8_t** )calloc(2, sizeof(uint8_t* )); qual_filt_lv1[r_i][0] = (uint8_t* )calloc(readlen_max, 1); qual_filt_lv1[r_i][1] = (uint8_t* )calloc(readlen_max, 1); } qual_filt_lv2 = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { qual_filt_lv2[r_i] = (uint8_t** )calloc(2, sizeof(uint8_t* )); qual_filt_lv2[r_i][0] = (uint8_t* )calloc(readlen_max, 1); qual_filt_lv2[r_i][1] = (uint8_t* )calloc(readlen_max, 1); } #endif #ifdef MAPPING_QUALITY mp_subs1 = (float*** )calloc(thread_n, sizeof(float** )); for(r_i = 0; r_i < thread_n; r_i++) { mp_subs1[r_i] = (float** )calloc(2, sizeof(float* )); mp_subs1[r_i][0] = (float* )calloc(readlen_max, sizeof(float)); mp_subs1[r_i][1] = (float* )calloc(readlen_max, sizeof(float)); } mp_subs2 = (float*** )calloc(thread_n, sizeof(float** )); for(r_i = 0; r_i < thread_n; r_i++) { mp_subs2[r_i] = (float** )calloc(2, sizeof(float* )); mp_subs2[r_i][0] = (float* )calloc(readlen_max, sizeof(float)); mp_subs2[r_i][1] = (float* )calloc(readlen_max, sizeof(float)); } sub_t = (float* )calloc(thread_n, sizeof(float )); #endif #ifdef PR_COV_FILTER cov_filt_f = (uint8_t* )calloc(thread_n, 1); #endif //end thread gloabl value #endif fprintf(stderr, "successfully allocate memory\n"); InitiateLVCompute(L, thread_n); //for pthread read input fprintf(stderr, "Load seq input memory\n"); seqio = (seq_io* )calloc(read_in, sizeof(seq_io)); char** read_seq1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) read_seq1_buffer[r_i] = (char* )calloc(readlen_max, 1); char** read_seq2_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) read_seq2_buffer[r_i] = (char* )calloc(readlen_max, 1); char** name_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) name_buffer[r_i] = (char* )calloc(readlen_name, 1); char** name_buffer_other= (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) name_buffer_other[r_i] = (char* )calloc(readlen_name, 1); qual1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) qual1_buffer[r_i] = (char* )calloc(readlen_max, 1); qual2_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) qual2_buffer[r_i] = (char* )calloc(readlen_max, 1); #ifdef FIX_SA read_rev_buffer_1 = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) read_rev_buffer_1[r_i] = (char* )calloc(readlen_max, 1); #endif #ifdef OUTPUT_ARR read_rev_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) read_rev_buffer[r_i] = (char* )calloc(readlen_max, 1); pr_cigar1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) pr_cigar1_buffer[r_i] = (char* )calloc(cigar_max_n, 1); pr_cigar2_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) pr_cigar2_buffer[r_i] = (char* )calloc(cigar_max_n, 1); chr_res_buffer = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) chr_res_buffer[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); #ifdef FIX_SV chr_res_buffer1 = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) chr_res_buffer1[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); chr_res_buffer2 = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) chr_res_buffer2[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); #endif xa_d1s_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) xa_d1s_buffer[r_i] = (char* )calloc(CUS_MAX_OUTPUT_ALI2, 1); xa_d2s_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) xa_d2s_buffer[r_i] = (char* )calloc(CUS_MAX_OUTPUT_ALI2, 1); sam_pos1s_buffer = (uint32_t** )calloc(read_in, sizeof(uint32_t* )); for(r_i = 0; r_i < read_in; r_i++) sam_pos1s_buffer[r_i] = (uint32_t* )calloc(CUS_MAX_OUTPUT_ALI2, 4); sam_pos2s_buffer = (uint32_t** )calloc(read_in, sizeof(uint32_t* )); for(r_i = 0; r_i < read_in; r_i++) sam_pos2s_buffer[r_i] = (uint32_t* )calloc(CUS_MAX_OUTPUT_ALI2, 4); lv_re1s_buffer = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) lv_re1s_buffer[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); lv_re2s_buffer = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) lv_re2s_buffer[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); #ifdef PR_SINGLE chr_res1_buffer = (uint8_t** )calloc(read_in, sizeof(uint8_t* )); for(r_i = 0; r_i < read_in; r_i++) chr_res1_buffer[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); chr_res2_buffer = (uint8_t** )calloc(read_in, sizeof(uint8_t* )); for(r_i = 0; r_i < read_in; r_i++) chr_res2_buffer[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); xa_ds1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) xa_ds1_buffer[r_i] = (char* )calloc(pr_single_outputn, 1); xa_ds2_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) xa_ds2_buffer[r_i] = (char* )calloc(pr_single_outputn, 1); lv_res1_buffer = (uint8_t** )calloc(read_in, sizeof(uint8_t* )); for(r_i = 0; r_i < read_in; r_i++) lv_res1_buffer[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); lv_res2_buffer = (uint8_t** )calloc(read_in, sizeof(uint8_t* )); for(r_i = 0; r_i < read_in; r_i++) lv_res2_buffer[r_i] = (uint8_t* )calloc(pr_single_outputn, 1); sam_poss1_buffer = (uint32_t** )calloc(read_in, sizeof(uint32_t* )); for(r_i = 0; r_i < read_in; r_i++) sam_poss1_buffer[r_i] = (uint32_t* )calloc(pr_single_outputn, 4); sam_poss2_buffer = (uint32_t** )calloc(read_in, sizeof(uint32_t* )); for(r_i = 0; r_i < read_in; r_i++) sam_poss2_buffer[r_i] = (uint32_t* )calloc(pr_single_outputn, 4); #endif #endif #ifdef KSW_ALN_PAIR ali_ref_seq2 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) ali_ref_seq2[r_i] = (char* )calloc(readlen_max + 64, 1); read_char2 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) read_char2[r_i] = (char* )calloc(readlen_max + 32, 1); op_dm_kl1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_kl1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_kr1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_kr1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_kl2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_kl2[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_kr2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_kr2[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_kl1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_kl1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_kr1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_kr1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_kl2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_kl2[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_kr2 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_kr2[r_i] = (int* )calloc(cus_max_output_ali, 4); mat = (int8_t*)calloc(25, sizeof(int8_t)); for (l = k1 = 0; l < 4; ++l) { for (m = 0; m < 4; ++m) mat[k1++] = l == m ? mat_score : -mis_score; /* weight_match : -weight_mismatch */ mat[k1++] = -1; // ambiguous base } for (m = 0; m < 5; ++m) mat[k1++] = 0; #endif #ifdef PAIR_RANDOM for(r_i = 0; r_i < thread_n; r_i++) { read_bit_pr[r_i][0] = read_bit1[r_i][0]; read_bit_pr[r_i][1] = read_bit2[r_i][1]; read_bit_pr[r_i][2] = read_bit2[r_i][0]; read_bit_pr[r_i][3] = read_bit1[r_i][1]; read_val_pr[r_i][0] = read_val1[r_i][0]; read_val_pr[r_i][1] = read_val2[r_i][1]; read_val_pr[r_i][2] = read_val2[r_i][0]; read_val_pr[r_i][3] = read_val1[r_i][1]; } #endif end = clock(); t = (double)(end - start) / CLOCKS_PER_SEC; fprintf(stderr, "%lf seconds is used for allocating memory\n", t); //write .sam head into result file if(flag_std) for(r_i = 1; r_i < chr_file_n; r_i++) printf("@SQ\tSN:%s\tLN:%u\n", chr_names[r_i], (uint32_t )(chr_end_n[r_i] - chr_end_n[r_i - 1])); else for(r_i = 1; r_i < chr_file_n; r_i++) fprintf(fp_sam, "@SQ\tSN:%s\tLN:%u\n", chr_names[r_i], (uint32_t )(chr_end_n[r_i] - chr_end_n[r_i - 1])); #ifdef RD_FILED if(flag_std) { printf("@RG\tID:L1\tPU:SC_1_10\tLB:SC_1\tSM:NA12878\n"); printf("@RG\tID:L2\tPU:SC_2_12\tLB:SC_2\tSM:NA12878\n"); }else{ fprintf(fp_sam, "@RG\tID:L1\tPU:SC_1_10\tLB:SC_1\tSM:NA12878\n"); fprintf(fp_sam, "@RG\tID:L2\tPU:SC_2_12\tLB:SC_2\tSM:NA12878\n"); } #endif fprintf(stderr, "begin reading fastq pair-end reads and doing alignment\n"); //fflush(stdout); #ifdef R_W_LOCK pthread_rwlock_init(&rwlock, NULL); int seqii_i = 0; #endif double dtime = omp_get_wtime(); //value in seconds int read_length_tmp1 = 0; int read_length_tmp2 = 0; char tmp_pos_ch; #ifdef FIX_SA uint16_t xa_n_p1_tmp = 0; uint16_t sam_seq_i = 0; char sam_seq1[MAX_READLEN] = {}; uint16_t flag_tmp = 0; char* seq_tmp = NULL; char* read_tmp = NULL; char* qual_tmp = NULL; #endif while ((kr1 > 0) && (kr2 > 0)) { for(seqii = 0; (seqii < read_in) && (((kr1 = kseq_read(seq1)) > 0) && ((kr2 = kseq_read(seq2)) > 0)); seqii++) //((kr1 > 0) && (kr2 > 0)) { strncpy(name_buffer[seqii], seq1->name.s, seq1->name.l); strncpy(name_buffer_other[seqii], seq2->name.s, seq2->name.l); if((seq1->name.s)[seq1->name.l - 2] == '/') name_buffer[seqii][seq1->name.l - 2] = '\0'; else name_buffer[seqii][seq1->name.l] = '\0'; if((seq2->name.s)[seq2->name.l - 2] == '/') name_buffer_other[seqii][seq2->name.l - 2] = '\0'; else name_buffer_other[seqii][seq2->name.l] = '\0'; if(seq1->seq.l > readlen_max) { seqio[seqii].read_length1 = readlen_max; seqio[seqii].length_h1 = seq1->seq.l - readlen_max; } else { seqio[seqii].read_length1 = seq1->seq.l; seqio[seqii].length_h1 = 0; } if(seq2->seq.l > readlen_max) { seqio[seqii].read_length2 = readlen_max; seqio[seqii].length_h2 = seq2->seq.l - readlen_max; } else { seqio[seqii].read_length2 = seq2->seq.l; seqio[seqii].length_h2 = 0; } read_length_tmp1 = seqio[seqii].read_length1; read_length_tmp2 = seqio[seqii].read_length2; strncpy(read_seq1_buffer[seqii], seq1->seq.s, read_length_tmp1); strncpy(read_seq2_buffer[seqii], seq2->seq.s, read_length_tmp2); read_seq1_buffer[seqii][read_length_tmp1] = '\0'; read_seq2_buffer[seqii][read_length_tmp2] = '\0'; strncpy(qual1_buffer[seqii], seq1->qual.s, read_length_tmp1); strncpy(qual2_buffer[seqii], seq2->qual.s, read_length_tmp2); qual1_buffer[seqii][read_length_tmp1] = '\0'; qual2_buffer[seqii][read_length_tmp2] = '\0'; seqio[seqii].read_seq1 = read_seq1_buffer[seqii]; seqio[seqii].read_seq2 = read_seq2_buffer[seqii]; seqio[seqii].name = name_buffer[seqii]; seqio[seqii].name_other = name_buffer_other[seqii]; seqio[seqii].qual1 = qual1_buffer[seqii]; seqio[seqii].qual2 = qual2_buffer[seqii]; } if(thread_n <= 1) { #ifdef R_W_LOCK for(seqii_i = 0; seqii_i < seqii; seqii_i++) seed_ali_core(seqii_i, 0); #else seed_ali_core(seqii, 0); #endif } else { pthread_t* tid; thread_ali_t* data; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); data = (thread_ali_t* )calloc(thread_n, sizeof(thread_ali_t )); tid = (pthread_t* )calloc(thread_n, sizeof(pthread_t )); #ifdef R_W_LOCK read_seq = 0; #endif for(r_i = 0; r_i < thread_n; ++r_i) { data[r_i].tid = r_i; data[r_i].seqn = seqii; pthread_create(&tid[r_i], &attr, worker, data + r_i); } for(r_i = 0; r_i < thread_n; ++r_i) pthread_join(tid[r_i], 0); free(data); free(tid); } if(flag_std) { //output #ifdef OUTPUT_ARR for(seqi = 0; seqi < seqii; seqi++) { if((seqio[seqi].flag1 == 77) && (seqio[seqi].flag2 == 141)) tmp_pos_ch = '*'; else tmp_pos_ch = '='; if(seqio[seqi].length_h1 == 0) { if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].cross, seqio[seqi].seq1, seqio[seqi].qual1 ); } else { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, tmp_pos_ch, seqio[seqi].pos1, seqio[seqi].seq1, seqio[seqi].qual1 ); } if(seqio[seqi].xa_n_p1 > 0) { printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p1; v_cnt_i++) printf("%s,%c%u,%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d1s[v_cnt_i], seqio[seqi].sam_pos1s[v_cnt_i], seqio[seqi].cigar_p1s[v_cnt_i], seqio[seqi].lv_re1s[v_cnt_i]); } #ifdef PR_SINGLE if(seqio[seqi].xa_n1 > 0) { if((seqio[seqi].xa_n_p1 == 0) && (seqio[seqi].xa_n1 > 0)) printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n1; v_cnt_i++) printf("%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res1[v_cnt_i]], seqio[seqi].xa_ds1[v_cnt_i], seqio[seqi].sam_poss1[v_cnt_i], seqio[seqi].read_length1, seqio[seqi].lv_res1[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x1 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p1; printf("\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x1; v_cnt_i++) { printf("%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s1[v_cnt_i]], seqio[seqi].sam_pos1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc1, seqio[seqi].lv_re1s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED printf("\tNM:i:%u\tRG:Z:L1\n", seqio[seqi].nm1); #else printf("\tNM:i:%u\n", seqio[seqi].nm1); #endif } else { sprintf(h_chars, "%uH", seqio[seqi].length_h1); if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, h_chars, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].cross, seqio[seqi].seq1, seqio[seqi].qual1 ); } else { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, h_chars, tmp_pos_ch, seqio[seqi].pos1, seqio[seqi].seq1, seqio[seqi].qual1 ); } if(seqio[seqi].xa_n_p1 > 0) { printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p1; v_cnt_i++) { printf("%s,%c%u,%s%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d1s[v_cnt_i], seqio[seqi].sam_pos1s[v_cnt_i], seqio[seqi].cigar_p1s[v_cnt_i], h_chars, seqio[seqi].lv_re1s[v_cnt_i]); } } printf("NM:i:%u\t", seqio[seqi].nm1); #ifdef PR_SINGLE if(seqio[seqi].xa_n1 > 0) { if((seqio[seqi].xa_n_p1 == 0) && (seqio[seqi].xa_n1 > 0)) printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n1; v_cnt_i++) printf("%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res1[v_cnt_i]], seqio[seqi].xa_ds1[v_cnt_i], seqio[seqi].sam_poss1[v_cnt_i], seqio[seqi].read_length1, seqio[seqi].lv_res1[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x1 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p1; printf("\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x1; v_cnt_i++) { printf("%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s1[v_cnt_i]], seqio[seqi].sam_pos1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc1, seqio[seqi].lv_re1s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED printf("\tNM:i:%u\tRG:Z:L1\n", seqio[seqi].nm1); #else printf("\tNM:i:%u\n", seqio[seqi].nm1); #endif } #ifdef FIX_SV #ifndef FIX_SA for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x1; v_cnt_i++) { if(seqio[seqi].xa_d1s[v_cnt_i + seqio[seqi].xa_n_p1] == '+') { flag_tmp = 2145; seq_tmp = seqio[seqi].read_seq1; } else { flag_tmp = 2129; read_tmp = seqio[seqi].read_seq1; for(sam_seq_i = 0; sam_seq_i < seqio[seqi].read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[read_tmp[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); seq_tmp = sam_seq1; } qual_tmp = seqio[seqi].qual1; printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%d\t%s\t%s\tNM:i:%u\tRG:Z:L1\n", seqio[seqi].name, flag_tmp, chr_names[seqio[seqi].chr_res_s1[v_cnt_i]], seqio[seqi].sam_pos1s[v_cnt_i + seqio[seqi].xa_n_p1], seqio[seqi].qualc1, seqio[seqi].cigar_p1s[v_cnt_i + seqio[seqi].xa_n_p1], tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].pos2 - seqio[seqi].sam_pos1s[v_cnt_i + seqio[seqi].xa_n_p1], seq_tmp, qual_tmp, seqio[seqi].lv_re1s[v_cnt_i + seqio[seqi].xa_n_p1] ); } #endif #endif if(seqio[seqi].length_h2 == 0) { if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, tmp_pos_ch, seqio[seqi].pos1, -seqio[seqi].cross, seqio[seqi].seq2, seqio[seqi].qual2 ); } else { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].seq2, seqio[seqi].qual2 ); } if(seqio[seqi].xa_n_p2 > 0) { printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p2; v_cnt_i++) printf("%s,%c%u,%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d2s[v_cnt_i], seqio[seqi].sam_pos2s[v_cnt_i], seqio[seqi].cigar_p2s[v_cnt_i], seqio[seqi].lv_re2s[v_cnt_i]); } #ifdef PR_SINGLE if(seqio[seqi].xa_n2 > 0) { if((seqio[seqi].xa_n_p2 == 0) && (seqio[seqi].xa_n2 > 0)) printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n2; v_cnt_i++) printf("%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res2[v_cnt_i]], seqio[seqi].xa_ds2[v_cnt_i], seqio[seqi].sam_poss2[v_cnt_i], seqio[seqi].read_length2, seqio[seqi].lv_res2[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x2 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p2; printf("\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x2; v_cnt_i++) { printf("%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s2[v_cnt_i]], seqio[seqi].sam_pos2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc2, seqio[seqi].lv_re2s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED printf("\tNM:i:%u\tRG:Z:L2\n", seqio[seqi].nm2); #else printf("\tNM:i:%u\n", seqio[seqi].nm2); #endif } else { sprintf(h_chars, "%uH", seqio[seqi].length_h2); if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, h_chars, tmp_pos_ch, seqio[seqi].pos1, -seqio[seqi].cross, seqio[seqi].seq2, seqio[seqi].qual2 ); } else { printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, h_chars, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].seq2, seqio[seqi].qual2 ); } if(seqio[seqi].xa_n_p2 > 0) { printf( "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p2; v_cnt_i++) { printf("%s,%c%u,%s%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d2s[v_cnt_i], seqio[seqi].sam_pos2s[v_cnt_i], seqio[seqi].cigar_p2s[v_cnt_i], h_chars, seqio[seqi].lv_re2s[v_cnt_i]); } } #ifdef PR_SINGLE if(seqio[seqi].xa_n2 > 0) { if((seqio[seqi].xa_n_p2 == 0) && (seqio[seqi].xa_n2 > 0)) printf("\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n2; v_cnt_i++) printf("%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res2[v_cnt_i]], seqio[seqi].xa_ds2[v_cnt_i], seqio[seqi].sam_poss2[v_cnt_i], seqio[seqi].read_length2, seqio[seqi].lv_res2[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x2 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p2; printf("\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x2; v_cnt_i++) { printf("%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s2[v_cnt_i]], seqio[seqi].sam_pos2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc2, seqio[seqi].lv_re2s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED printf("\tNM:i:%u\tRG:Z:L2\n", seqio[seqi].nm2); #else printf("\tNM:i:%u\n", seqio[seqi].nm2); #endif } #ifdef FIX_SV #ifndef FIX_SA for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x2; v_cnt_i++) { if(seqio[seqi].xa_d2s[v_cnt_i + seqio[seqi].xa_n_p2] == '+') { flag_tmp = 2209; seq_tmp = seqio[seqi].read_seq2; } else { flag_tmp = 2193; read_tmp = seqio[seqi].read_seq2; for(sam_seq_i = 0; sam_seq_i < seqio[seqi].read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[read_tmp[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); seq_tmp = sam_seq1; } qual_tmp = seqio[seqi].qual2; //seqio[seqi].read_seq1 //read_rev_buffer[seqi] printf("%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%d\t%s\t%s\tNM:i:%u\tRG:Z:L2\n", seqio[seqi].name_other, flag_tmp, chr_names[seqio[seqi].chr_res_s2[v_cnt_i]], seqio[seqi].sam_pos2s[v_cnt_i + seqio[seqi].xa_n_p2], seqio[seqi].qualc2, seqio[seqi].cigar_p2s[v_cnt_i + seqio[seqi].xa_n_p2], tmp_pos_ch, seqio[seqi].sam_pos2s[v_cnt_i + seqio[seqi].xa_n_p2], seqio[seqi].sam_pos2s[v_cnt_i + seqio[seqi].xa_n_p2] - seqio[seqi].pos1, seq_tmp, qual_tmp, seqio[seqi].lv_re2s[v_cnt_i + seqio[seqi].xa_n_p2] ); } #endif #endif } #endif } else { //output #ifdef OUTPUT_ARR for(seqi = 0; seqi < seqii; seqi++) { if((seqio[seqi].flag1 == 77) && (seqio[seqi].flag2 == 141)) tmp_pos_ch = '*'; else tmp_pos_ch = '='; if(seqio[seqi].length_h1 == 0) { if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].cross, seqio[seqi].seq1, seqio[seqi].qual1 ); } else { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, tmp_pos_ch, seqio[seqi].pos1, seqio[seqi].seq1, seqio[seqi].qual1 ); } if(seqio[seqi].xa_n_p1 > 0) { fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p1; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d1s[v_cnt_i], seqio[seqi].sam_pos1s[v_cnt_i], seqio[seqi].cigar_p1s[v_cnt_i], seqio[seqi].lv_re1s[v_cnt_i]); } #ifdef PR_SINGLE if(seqio[seqi].xa_n1 > 0) { if((seqio[seqi].xa_n_p1 == 0) && (seqio[seqi].xa_n1 > 0)) fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n1; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res1[v_cnt_i]], seqio[seqi].xa_ds1[v_cnt_i], seqio[seqi].sam_poss1[v_cnt_i], seqio[seqi].read_length1, seqio[seqi].lv_res1[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x1 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p1; fprintf(fp_sam, "\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x1; v_cnt_i++) { fprintf(fp_sam, "%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s1[v_cnt_i]], seqio[seqi].sam_pos1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc1, seqio[seqi].lv_re1s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED fprintf(fp_sam, "\tNM:i:%u\tRG:Z:L1\n", seqio[seqi].nm1); #else fprintf(fp_sam, "\tNM:i:%u\n", seqio[seqi].nm1); #endif } else { sprintf(h_chars, "%uH", seqio[seqi].length_h1); if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, h_chars, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].cross, seqio[seqi].seq1, seqio[seqi].qual1 ); } else { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re1], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, h_chars, tmp_pos_ch, seqio[seqi].pos1, seqio[seqi].seq1, seqio[seqi].qual1 ); } if(seqio[seqi].xa_n_p1 > 0) { fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p1; v_cnt_i++) { fprintf(fp_sam, "%s,%c%u,%s%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d1s[v_cnt_i], seqio[seqi].sam_pos1s[v_cnt_i], seqio[seqi].cigar_p1s[v_cnt_i], h_chars, seqio[seqi].lv_re1s[v_cnt_i]); } } fprintf(fp_sam, "NM:i:%u\t", seqio[seqi].nm1); #ifdef PR_SINGLE if(seqio[seqi].xa_n1 > 0) { if((seqio[seqi].xa_n_p1 == 0) && (seqio[seqi].xa_n1 > 0)) fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n1; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res1[v_cnt_i]], seqio[seqi].xa_ds1[v_cnt_i], seqio[seqi].sam_poss1[v_cnt_i], seqio[seqi].read_length1, seqio[seqi].lv_res1[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x1 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p1; fprintf(fp_sam, "\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x1; v_cnt_i++) { fprintf(fp_sam, "%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s1[v_cnt_i]], seqio[seqi].sam_pos1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p1s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc1, seqio[seqi].lv_re1s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED fprintf(fp_sam, "\tNM:i:%u\tRG:Z:L1\n", seqio[seqi].nm1); #else fprintf(fp_sam, "\tNM:i:%u\n", seqio[seqi].nm1); #endif } #ifdef FIX_SV #ifndef FIX_SA for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x1; v_cnt_i++) { if(seqio[seqi].xa_d1s[v_cnt_i + seqio[seqi].xa_n_p1] == '+') { flag_tmp = 2145; seq_tmp = seqio[seqi].read_seq1; } else { flag_tmp = 2129; read_tmp = seqio[seqi].read_seq1; for(sam_seq_i = 0; sam_seq_i < seqio[seqi].read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[read_tmp[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); seq_tmp = sam_seq1; } qual_tmp = seqio[seqi].qual1; fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%d\t%s\t%s\tNM:i:%u\tRG:Z:L1\n", seqio[seqi].name, flag_tmp, chr_names[seqio[seqi].chr_res_s1[v_cnt_i]], seqio[seqi].sam_pos1s[v_cnt_i + seqio[seqi].xa_n_p1], seqio[seqi].qualc1, seqio[seqi].cigar_p1s[v_cnt_i + seqio[seqi].xa_n_p1], tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].pos2 - seqio[seqi].sam_pos1s[v_cnt_i + seqio[seqi].xa_n_p1], seq_tmp, qual_tmp, seqio[seqi].lv_re1s[v_cnt_i + seqio[seqi].xa_n_p1] ); } #endif #endif if(seqio[seqi].length_h2 == 0) { if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, tmp_pos_ch, seqio[seqi].pos1, -seqio[seqi].cross, seqio[seqi].seq2, seqio[seqi].qual2 ); } else { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].seq2, seqio[seqi].qual2 ); } if(seqio[seqi].xa_n_p2 > 0) { fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p2; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d2s[v_cnt_i], seqio[seqi].sam_pos2s[v_cnt_i], seqio[seqi].cigar_p2s[v_cnt_i], seqio[seqi].lv_re2s[v_cnt_i]); } #ifdef PR_SINGLE if(seqio[seqi].xa_n2 > 0) { if((seqio[seqi].xa_n_p2 == 0) && (seqio[seqi].xa_n2 > 0)) fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n2; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res2[v_cnt_i]], seqio[seqi].xa_ds2[v_cnt_i], seqio[seqi].sam_poss2[v_cnt_i], seqio[seqi].read_length2, seqio[seqi].lv_res2[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x2 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p2; fprintf(fp_sam, "\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x2; v_cnt_i++) { fprintf(fp_sam, "%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s2[v_cnt_i]], seqio[seqi].sam_pos2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc2, seqio[seqi].lv_re2s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED fprintf(fp_sam, "\tNM:i:%u\tRG:Z:L2\n", seqio[seqi].nm2); #else fprintf(fp_sam, "\tNM:i:%u\n", seqio[seqi].nm2); #endif } else { sprintf(h_chars, "%uH", seqio[seqi].length_h2); if(seqio[seqi].chr_re1 == seqio[seqi].chr_re2) { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t%"PRId64"\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, h_chars, tmp_pos_ch, seqio[seqi].pos1, -seqio[seqi].cross, seqio[seqi].seq2, seqio[seqi].qual2 ); } else { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t%c\t%"PRId64"\t0\t%s\t%s", seqio[seqi].name_other, seqio[seqi].flag2, chr_names[seqio[seqi].chr_re2], seqio[seqi].pos2, seqio[seqi].qualc2, seqio[seqi].cigar2, h_chars, tmp_pos_ch, seqio[seqi].pos2, seqio[seqi].seq2, seqio[seqi].qual2 ); } if(seqio[seqi].xa_n_p2 > 0) { fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p2; v_cnt_i++) { fprintf(fp_sam, "%s,%c%u,%s%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d2s[v_cnt_i], seqio[seqi].sam_pos2s[v_cnt_i], seqio[seqi].cigar_p2s[v_cnt_i], h_chars, seqio[seqi].lv_re2s[v_cnt_i]); } } #ifdef PR_SINGLE if(seqio[seqi].xa_n2 > 0) { if((seqio[seqi].xa_n_p2 == 0) && (seqio[seqi].xa_n2 > 0)) fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n2; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%uM,%u;", chr_names[seqio[seqi].chr_res2[v_cnt_i]], seqio[seqi].xa_ds2[v_cnt_i], seqio[seqi].sam_poss2[v_cnt_i], seqio[seqi].read_length2, seqio[seqi].lv_res2[v_cnt_i]); } #endif #ifdef FIX_SA if(seqio[seqi].xa_n_x2 > 0) { xa_n_p1_tmp = seqio[seqi].xa_n_p2; fprintf(fp_sam, "\tSA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x2; v_cnt_i++) { fprintf(fp_sam, "%s,%u,%c,%s,%u,%d;", chr_names[seqio[seqi].chr_res_s2[v_cnt_i]], seqio[seqi].sam_pos2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].xa_d2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].cigar_p2s[v_cnt_i + xa_n_p1_tmp], seqio[seqi].qualc2, seqio[seqi].lv_re2s[v_cnt_i + xa_n_p1_tmp]); } } #endif #ifdef RD_FILED fprintf(fp_sam, "\tNM:i:%u\tRG:Z:L2\n", seqio[seqi].nm2); #else fprintf(fp_sam, "\tNM:i:%u\n", seqio[seqi].nm2); #endif } #ifdef FIX_SV #ifndef FIX_SA for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_x2; v_cnt_i++) { if(seqio[seqi].xa_d2s[v_cnt_i + seqio[seqi].xa_n_p2] == '+') { flag_tmp = 2209; seq_tmp = seqio[seqi].read_seq2; } else { flag_tmp = 2193; read_tmp = seqio[seqi].read_seq2; for(sam_seq_i = 0; sam_seq_i < seqio[seqi].read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[read_tmp[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); seq_tmp = sam_seq1; } qual_tmp = seqio[seqi].qual2; //seqio[seqi].read_seq1 //read_rev_buffer[seqi] fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t%c\t%"PRId64"\t%d\t%s\t%s\tNM:i:%u\tRG:Z:L2\n", seqio[seqi].name_other, flag_tmp, chr_names[seqio[seqi].chr_res_s2[v_cnt_i]], seqio[seqi].sam_pos2s[v_cnt_i + seqio[seqi].xa_n_p2], seqio[seqi].qualc2, seqio[seqi].cigar_p2s[v_cnt_i + seqio[seqi].xa_n_p2], tmp_pos_ch, seqio[seqi].sam_pos2s[v_cnt_i + seqio[seqi].xa_n_p2], seqio[seqi].sam_pos2s[v_cnt_i + seqio[seqi].xa_n_p2] - seqio[seqi].pos1, seq_tmp, qual_tmp, seqio[seqi].lv_re2s[v_cnt_i + seqio[seqi].xa_n_p2] ); } #endif #endif } #endif } #ifdef POST_DEBUG printf("print end\n"); #endif #ifdef OUTPUT_ARR for(seqi = 0; seqi < seqii; seqi++) { if(seqio[seqi].v_cnt > 0) { for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p1; v_cnt_i++) free(seqio[seqi].cigar_p1s[v_cnt_i]); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n_p2; v_cnt_i++) free(seqio[seqi].cigar_p2s[v_cnt_i]); } } #endif } dtime = omp_get_wtime() - dtime; fprintf(stderr, "%lf seconds is used in mapping\n", dtime); fflush(stdout); #ifdef R_W_LOCK pthread_rwlock_destroy(&rwlock); #endif if(flag_std == 0) fclose(fp_sam); kseq_destroy(seq1); gzclose(fp1); kseq_destroy(seq2); gzclose(fp2); #ifdef STA_SEED fclose(fp_read); fclose(fp_seed); #endif #ifdef PTHREAD_USE fprintf(stderr, "free memory\n"); if(g_low != NULL) free(g_low); if(r_low != NULL) free(r_low); for(r_i = 0; r_i < thread_n; r_i++) if(seedm[r_i] != NULL) free(seedm[r_i]); if(seedm != NULL) free(seedm); for(r_i = 0; r_i < thread_n; r_i++) if(seedu[r_i] != NULL) free(seedu[r_i]); if(seedu != NULL) free(seedu); for(r_i = 0; r_i < thread_n; r_i++) if(seedsets[r_i] != NULL) free(seedsets[r_i]); if(seedsets != NULL) free(seedsets); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_off[r_i] != NULL) free(seed_set_off[r_i]); if(seed_set_off != NULL) free(seed_set_off); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_pos[0][0][r_i] != NULL) free(seed_set_pos[0][0][r_i]); if(seed_set_pos[0][0] != NULL) free(seed_set_pos[0][0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_pos[0][1][r_i] != NULL) free(seed_set_pos[0][1][r_i]); if(seed_set_pos[0][1] != NULL) free(seed_set_pos[0][1]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_pos[1][0][r_i] != NULL) free(seed_set_pos[1][0][r_i]); if(seed_set_pos[1][0] != NULL) free(seed_set_pos[1][0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_pos[1][1][r_i] != NULL) free(seed_set_pos[1][1][r_i]); if(seed_set_pos[1][1] != NULL) free(seed_set_pos[1][1]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpa1[0][r_i] != NULL) free(seedpa1[0][r_i]); if(seedpa1[0] != NULL) free(seedpa1[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpa1[1][r_i] != NULL) free(seedpa1[1][r_i]); if(seedpa1[1] != NULL) free(seedpa1[1]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpa2[0][r_i] != NULL) free(seedpa2[0][r_i]); if(seedpa2[0] != NULL) free(seedpa2[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpa2[1][r_i] != NULL) free(seedpa2[1][r_i]); if(seedpa2[1] != NULL) free(seedpa2[1]); #ifdef ALTER_DEBUG for(r_i = 0; r_i < thread_n; r_i++) if(seed_length_arr[r_i] != NULL) free(seed_length_arr[r_i]); if(seed_length_arr != NULL) free(seed_length_arr); if(rep_go != NULL) free(rep_go); #endif #ifdef REDUCE_ANCHOR for(r_i = 0; r_i < thread_n; r_i++) if(poses1[r_i] != NULL) free(poses1[r_i]); if(poses1 != NULL) free(poses1); for(r_i = 0; r_i < thread_n; r_i++) if(poses2[r_i] != NULL) free(poses2[r_i]); if(poses2 != NULL) free(poses2); for(r_i = 0; r_i < thread_n; r_i++) if(ls1[r_i] != NULL) free(ls1[r_i]); if(ls1 != NULL) free(ls1); for(r_i = 0; r_i < thread_n; r_i++) if(ls2[r_i] != NULL) free(ls2[r_i]); if(ls2 != NULL) free(ls2); for(r_i = 0; r_i < thread_n; r_i++) if(rs1[r_i] != NULL) free(rs1[r_i]); if(rs1 != NULL) free(rs1); for(r_i = 0; r_i < thread_n; r_i++) if(rs2[r_i] != NULL) free(rs2[r_i]); if(rs2 != NULL) free(rs2); for(r_i = 0; r_i < thread_n; r_i++) if(rcs1[r_i] != NULL) free(rcs1[r_i]); if(rcs1 != NULL) free(rcs1); for(r_i = 0; r_i < thread_n; r_i++) if(rcs2[r_i] != NULL) free(rcs2[r_i]); if(rcs2 != NULL) free(rcs2); #endif for(r_i = 0; r_i < thread_n; r_i++) if(op_vector_pos1[r_i] != NULL) free(op_vector_pos1[r_i]); if(op_vector_pos1 != NULL) free(op_vector_pos1); for(r_i = 0; r_i < thread_n; r_i++) if(op_vector_pos2[r_i] != NULL) free(op_vector_pos2[r_i]); if(op_vector_pos2 != NULL) free(op_vector_pos2); for(r_i = 0; r_i < thread_n; r_i++) if(ops_vector_pos1[r_i] != NULL) free(ops_vector_pos1[r_i]); if(ops_vector_pos1 != NULL) free(ops_vector_pos1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_vector_pos2[r_i] != NULL) free(ops_vector_pos2[r_i]); if(ops_vector_pos2 != NULL) free(ops_vector_pos2); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_l1[r_i] != NULL) free(op_dm_l1[r_i]); if(op_dm_l1 != NULL) free(op_dm_l1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_r1[r_i] != NULL) free(op_dm_r1[r_i]); if(op_dm_r1 != NULL) free(op_dm_r1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_l2[r_i] != NULL) free(op_dm_l2[r_i]); if(op_dm_l2 != NULL) free(op_dm_l2); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_r2[r_i] != NULL) free(op_dm_r2[r_i]); if(op_dm_r2 != NULL) free(op_dm_r2); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_l1[r_i] != NULL) free(ops_dm_l1[r_i]); if(ops_dm_l1 != NULL) free(ops_dm_l1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_r1[r_i] != NULL) free(ops_dm_r1[r_i]); if(ops_dm_r1 != NULL) free(ops_dm_r1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_l2[r_i] != NULL) free(ops_dm_l2[r_i]); if(ops_dm_l2 != NULL) free(ops_dm_l2); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_r2[r_i] != NULL) free(ops_dm_r2[r_i]); if(ops_dm_r2 != NULL) free(ops_dm_r2); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_ex1[r_i] != NULL) free(op_dm_ex1[r_i]); if(op_dm_ex1 != NULL) free(op_dm_ex1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_ex2[r_i] != NULL) free(op_dm_ex2[r_i]); if(op_dm_ex2 != NULL) free(op_dm_ex2); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_ex1[r_i] != NULL) free(ops_dm_ex1[r_i]); if(ops_dm_ex1 != NULL) free(ops_dm_ex1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_ex2[r_i] != NULL) free(ops_dm_ex2[r_i]); if(ops_dm_ex2 != NULL) free(ops_dm_ex2); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < cus_max_output_ali; m++) if(op_vector_seq1[r_i][m] != NULL) free(op_vector_seq1[r_i][m]); if(op_vector_seq1[r_i] != NULL) free(op_vector_seq1[r_i]); } if(op_vector_seq1 != NULL) free(op_vector_seq1); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < cus_max_output_ali; m++) if(op_vector_seq2[r_i][m] != NULL) free(op_vector_seq2[r_i][m]); if(op_vector_seq2[r_i] != NULL) free(op_vector_seq2[r_i]); } if(op_vector_seq2 != NULL) free(op_vector_seq2); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < cus_max_output_ali; m++) if(ops_vector_seq1[r_i][m] != NULL) free(ops_vector_seq1[r_i][m]); if(ops_vector_seq1[r_i] != NULL) free(ops_vector_seq1[r_i]); } if(ops_vector_seq1 != NULL) free(ops_vector_seq1); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < cus_max_output_ali; m++) if(ops_vector_seq2[r_i][m] != NULL) free(ops_vector_seq2[r_i][m]); if(ops_vector_seq2[r_i] != NULL) free(ops_vector_seq2[r_i]); } if(ops_vector_seq2 != NULL) free(ops_vector_seq2); #ifdef ALT_ALL for(r_i = 0; r_i < thread_n; r_i++) if(chr_res[r_i] != NULL) free(chr_res[r_i]); if(chr_res != NULL) free(chr_res); for(r_i = 0; r_i < thread_n; r_i++) if(sam_pos1s[r_i] != NULL) free(sam_pos1s[r_i]); if(sam_pos1s != NULL) free(sam_pos1s); for(r_i = 0; r_i < thread_n; r_i++) if(sam_pos2s[r_i] != NULL) free(sam_pos2s[r_i]); if(sam_pos2s != NULL) free(sam_pos2s); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < CUS_MAX_OUTPUT_ALI2; m++) if(cigar_p1s[r_i][m] != NULL) free(cigar_p1s[r_i][m]); if(cigar_p1s[r_i] != NULL) free(cigar_p1s[r_i]); } if(cigar_p1s != NULL) free(cigar_p1s); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < CUS_MAX_OUTPUT_ALI2; m++) if(cigar_p2s[r_i][m] != NULL) free(cigar_p2s[r_i][m]); if(cigar_p2s[r_i] != NULL) free(cigar_p2s[r_i]); } if(cigar_p2s != NULL) free(cigar_p2s); for(r_i = 0; r_i < thread_n; r_i++) if(xa_d1s[r_i] != NULL) free(xa_d1s[r_i]); if(xa_d1s != NULL) free(xa_d1s); for(r_i = 0; r_i < thread_n; r_i++) if(xa_d2s[r_i] != NULL) free(xa_d2s[r_i]); if(xa_d2s != NULL) free(xa_d2s); for(r_i = 0; r_i < thread_n; r_i++) if(lv_re1s[r_i] != NULL) free(lv_re1s[r_i]); if(lv_re1s != NULL) free(lv_re1s); for(r_i = 0; r_i < thread_n; r_i++) if(lv_re2s[r_i] != NULL) free(lv_re2s[r_i]); if(lv_re2s != NULL) free(lv_re2s); #endif for(r_i = 0; r_i < thread_n; r_i++) if(op_rc[r_i] != NULL) free(op_rc[r_i]); if(op_rc != NULL) free(op_rc); for(r_i = 0; r_i < thread_n; r_i++) if(ops_rc[r_i] != NULL) free(ops_rc[r_i]); if(ops_rc != NULL) free(ops_rc); for(r_i = 0; r_i < thread_n; r_i++) if(ref_seq_tmp1[r_i] != NULL) free(ref_seq_tmp1[r_i]); if(ref_seq_tmp1 != NULL) free(ref_seq_tmp1); for(r_i = 0; r_i < thread_n; r_i++) if(ref_seq_tmp2[r_i] != NULL) free(ref_seq_tmp2[r_i]); if(ref_seq_tmp2 != NULL) free(ref_seq_tmp2); for(r_i = 0; r_i < thread_n; r_i++) if(mat_pos1[r_i] != NULL) free(mat_pos1[r_i]); if(mat_pos1 != NULL) free(mat_pos1); for(r_i = 0; r_i < thread_n; r_i++) if(mat_pos2[r_i] != NULL) free(mat_pos2[r_i]); if(mat_pos2 != NULL) free(mat_pos2); for(r_i = 0; r_i < thread_n; r_i++) if(mat_rc[r_i] != NULL) free(mat_rc[r_i]); if(mat_rc != NULL) free(mat_rc); for(r_i = 0; r_i < thread_n; r_i++) if(seed_no1[r_i] != NULL) free(seed_no1[r_i]); if(seed_no1 != NULL) free(seed_no1); for(r_i = 0; r_i < thread_n; r_i++) if(seed_no2[r_i] != NULL) free(seed_no2[r_i]); if(seed_no2 != NULL) free(seed_no2); #ifdef PAIR_RANDOM for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < readlen_max / pair_ran_intvp; m++) if(seed_k_pos[r_i][m] != NULL) free(seed_k_pos[r_i][m]); if(seed_k_pos[r_i] != NULL) free(seed_k_pos[r_i]); } if(seed_k_pos != NULL) free(seed_k_pos); for(r_i = 0; r_i < thread_n; r_i++) if(seedposk[r_i] != NULL) free(seedposk[r_i]); if(seedposk != NULL) free(seedposk); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos[0][0][r_i] != NULL) free(seedpos[0][0][r_i]); if(seedpos[0][0] != NULL) free(seedpos[0][0]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos[0][1][r_i] != NULL) free(seedpos[0][1][r_i]); if(seedpos[0][1] != NULL) free(seedpos[0][1]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos[1][0][r_i] != NULL) free(seedpos[1][0][r_i]); if(seedpos[1][0] != NULL) free(seedpos[1][0]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos[1][1][r_i] != NULL) free(seedpos[1][1][r_i]); if(seedpos[1][1] != NULL) free(seedpos[1][1]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_posf[0][r_i] != NULL) free(seed_posf[0][r_i]); if(seed_posf[0] != NULL) free(seed_posf[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_posf[1][r_i] != NULL) free(seed_posf[1][r_i]); if(seed_posf[1] != NULL) free(seed_posf[1]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_pos[0][r_i] != NULL) free(seed_single_pos[0][r_i]); if(seed_single_pos[0] != NULL) free(seed_single_pos[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_pos[1][r_i] != NULL) free(seed_single_pos[1][r_i]); if(seed_single_pos[1] != NULL) free(seed_single_pos[1]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_ld[0][r_i] != NULL) free(seed_single_ld[0][r_i]); if(seed_single_ld[0] != NULL) free(seed_single_ld[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_ld[1][r_i] != NULL) free(seed_single_ld[1][r_i]); if(seed_single_ld[1] != NULL) free(seed_single_ld[1]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_rd[0][r_i] != NULL) free(seed_single_rd[0][r_i]); if(seed_single_rd[0] != NULL) free(seed_single_rd[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_rd[1][r_i] != NULL) free(seed_single_rd[1][r_i]); if(seed_single_rd[1] != NULL) free(seed_single_rd[1]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_dm[0][r_i] != NULL) free(seed_single_dm[0][r_i]); if(seed_single_dm[0] != NULL) free(seed_single_dm[0]); for(r_i = 0; r_i < thread_n; r_i++) if(seed_single_dm[1][r_i] != NULL) free(seed_single_dm[1][r_i]); if(seed_single_dm[1] != NULL) free(seed_single_dm[1]); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < (readlen_max / pair_ran_intvp) * RANDOM_RANGE; m++) if(seed_single_refs[0][r_i][m] != NULL) free(seed_single_refs[0][r_i][m]); if(seed_single_refs[0][r_i] != NULL) free(seed_single_refs[0][r_i]); } if(seed_single_refs[0] != NULL) free(seed_single_refs[0]); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < (readlen_max / pair_ran_intvp) * RANDOM_RANGE; m++) if(seed_single_refs[1][r_i][m] != NULL) free(seed_single_refs[1][r_i][m]); if(seed_single_refs[1][r_i] != NULL) free(seed_single_refs[1][r_i]); } if(seed_single_refs[1] != NULL) free(seed_single_refs[1]); #ifdef PR_SINGLE for(r_i = 0; r_i < thread_n; r_i++) if(seedpos_mis[0][0][r_i] != NULL) free(seedpos_mis[0][0][r_i]); if(seedpos_mis[0][0] != NULL) free(seedpos_mis[0][0]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos_mis[0][1][r_i] != NULL) free(seedpos_mis[0][1][r_i]); if(seedpos_mis[0][1] != NULL) free(seedpos_mis[0][1]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos_mis[1][0][r_i] != NULL) free(seedpos_mis[1][0][r_i]); if(seedpos_mis[1][0] != NULL) free(seedpos_mis[1][0]); for(r_i = 0; r_i < thread_n; r_i++) if(seedpos_mis[1][1][r_i] != NULL) free(seedpos_mis[1][1][r_i]); if(seedpos_mis[1][1] != NULL) free(seedpos_mis[1][1]); for(r_i = 0; r_i < thread_n; r_i++) if(pr_chr_res1[r_i] != NULL) free(pr_chr_res1[r_i]); if(pr_chr_res1 != NULL) free(pr_chr_res1); for(r_i = 0; r_i < thread_n; r_i++) if(pr_sam_pos1[r_i] != NULL) free(pr_sam_pos1[r_i]); if(pr_sam_pos1 != NULL) free(pr_sam_pos1); for(r_i = 0; r_i < thread_n; r_i++) if(pr_xa_d1[r_i] != NULL) free(pr_xa_d1[r_i]); if(pr_xa_d1 != NULL) free(pr_xa_d1); for(r_i = 0; r_i < thread_n; r_i++) if(pr_lv_re1[r_i] != NULL) free(pr_lv_re1[r_i]); if(pr_lv_re1 != NULL) free(pr_lv_re1); for(r_i = 0; r_i < thread_n; r_i++) if(pr_chr_res2[r_i] != NULL) free(pr_chr_res2[r_i]); if(pr_chr_res2 != NULL) free(pr_chr_res2); for(r_i = 0; r_i < thread_n; r_i++) if(pr_sam_pos2[r_i] != NULL) free(pr_sam_pos2[r_i]); if(pr_sam_pos2 != NULL) free(pr_sam_pos2); for(r_i = 0; r_i < thread_n; r_i++) if(pr_xa_d2[r_i] != NULL) free(pr_xa_d2[r_i]); if(pr_xa_d2 != NULL) free(pr_xa_d2); for(r_i = 0; r_i < thread_n; r_i++) if(pr_lv_re2[r_i] != NULL) free(pr_lv_re2[r_i]); if(pr_lv_re2 != NULL) free(pr_lv_re2); #endif #ifdef PAIR_RANDOM_SEED if(seed_r_dup != NULL) free(seed_r_dup); if(random_buffer != NULL) free(random_buffer); #endif #endif #ifdef READN_RANDOM_SEED if(random_buffer_readn) free(random_buffer_readn); #endif //thread gloabl value if(rc_cov_f != NULL) free(rc_cov_f); for(r_i = 0; r_i < thread_n; r_i++) if(cov_a_n[r_i] != NULL) free(cov_a_n[r_i]); if(cov_a_n != NULL) free(cov_a_n); if(cov_a_n_s != NULL) free(cov_a_n_s); if(s_uid_f != NULL) free(s_uid_f); if(min_mis != NULL) free(min_mis); if(de_m_p != NULL) free(de_m_p); if(de_m_p_o != NULL) free(de_m_p_o); if(seed_l != NULL) free(seed_l); if(max_mismatch1 != NULL) free(max_mismatch1); if(max_mismatch2 != NULL) free(max_mismatch2); if(max_mismatch1_single != NULL) free(max_mismatch1_single); if(max_mismatch2_single != NULL) free(max_mismatch2_single); #ifdef PR_SINGLE if(pr_o_f != NULL) free(pr_o_f); if(seed_re_r != NULL) free(seed_re_r); #endif //if(off_start != NULL) free(off_start); if(end_dis1 != NULL) free(end_dis1); if(end_dis2 != NULL) free(end_dis2); if(mat_posi != NULL) free(mat_posi); #ifdef PAIR_SEED_LENGTH_FILT if(max_lengtht != NULL) free(max_lengtht); #endif #ifdef REDUCE_ANCHOR for(r_i = 0; r_i < thread_n; r_i++) if(orders1[r_i] != NULL) free(orders1[r_i]); if(orders1 != NULL) free(orders1); for(r_i = 0; r_i < thread_n; r_i++) if(orders2[r_i] != NULL) free(orders2[r_i]); if(orders2 != NULL) free(orders2); for(r_i = 0; r_i < thread_n; r_i++) if(dms1[r_i] != NULL) free(dms1[r_i]); if(dms1 != NULL) free(dms1); for(r_i = 0; r_i < thread_n; r_i++) if(dms2[r_i] != NULL) free(dms2[r_i]); if(dms2 != NULL) free(dms2); #endif if(dm_op != NULL) free(dm_op); if(dm_ops != NULL) free(dm_ops); if(low_mask1 != NULL) free(low_mask1); if(low_mask2 != NULL) free(low_mask2); for(r_i = 0; r_i < thread_n; r_i++) if(pos_add[r_i] != NULL) free(pos_add[r_i]); if(pos_add != NULL) free(pos_add); for(r_i = 0; r_i < thread_n; r_i++) if(cigar_m1[r_i] != NULL) free(cigar_m1[r_i]); if(cigar_m1 != NULL) free(cigar_m1); for(r_i = 0; r_i < thread_n; r_i++) if(cigar_m2[r_i] != NULL) free(cigar_m2[r_i]); if(cigar_m2 != NULL) free(cigar_m2); for(r_i = 0; r_i < thread_n; r_i++) if(ali_ref_seq[r_i] != NULL) free(ali_ref_seq[r_i]); if(ali_ref_seq != NULL) free(ali_ref_seq); for(r_i = 0; r_i < thread_n; r_i++) if(read_char[r_i] != NULL) free(read_char[r_i]); if(read_char != NULL) free(read_char); if(pos_ren[0][0] != NULL) free(pos_ren[0][0]); if(pos_ren[0][1] != NULL) free(pos_ren[0][1]); if(pos_ren[1][0] != NULL) free(pos_ren[1][0]); if(pos_ren[1][1] != NULL) free(pos_ren[1][1]); for(r_i = 0; r_i < thread_n; r_i++) if(sub_mask1[r_i] != NULL) free(sub_mask1[r_i]); if(sub_mask1 != NULL) free(sub_mask1); for(r_i = 0; r_i < thread_n; r_i++) if(sub_mask2[r_i] != NULL) free(sub_mask2[r_i]); if(sub_mask2 != NULL) free(sub_mask2); if(seedpos_misn[0][0] != NULL) free(seedpos_misn[0][0]); if(seedpos_misn[0][1] != NULL) free(seedpos_misn[0][1]); if(seedpos_misn[1][0] != NULL) free(seedpos_misn[1][0]); if(seedpos_misn[1][1] != NULL) free(seedpos_misn[1][1]); for(r_i = 0; r_i < thread_n; r_i++) if(ex_d_mask1[r_i] != NULL) free(ex_d_mask1[r_i]); if(ex_d_mask1 != NULL) free(ex_d_mask1); for(r_i = 0; r_i < thread_n; r_i++) if(ex_d_mask2[r_i] != NULL) free(ex_d_mask2[r_i]); if(ex_d_mask2 != NULL) free(ex_d_mask2); #ifdef PAIR_RANDOM for(r_i = 0; r_i < thread_n; r_i++) if(b[r_i] != NULL) free(b[r_i]); if(b != NULL) free(b); for(r_i = 0; r_i < thread_n; r_i++) if(ls[r_i] != NULL) free(ls[r_i]); if(ls != NULL) free(ls); for(r_i = 0; r_i < thread_n; r_i++) if(read_bit_pr[r_i] != NULL) free(read_bit_pr[r_i]); if(read_bit_pr != NULL) free(read_bit_pr); for(r_i = 0; r_i < thread_n; r_i++) if(read_val_pr[r_i] != NULL) free(read_val_pr[r_i]); if(read_val_pr != NULL) free(read_val_pr); for(r_i = 0; r_i < thread_n; r_i++) if(kcol[r_i] != NULL) free(kcol[r_i]); if(kcol != NULL) free(kcol); if(seed_posn[0] != NULL) free(seed_posn[0]); if(seed_posn[1] != NULL) free(seed_posn[1]); if(seedn != NULL) free(seedn); #endif if(read_bit_1 != NULL) free(read_bit_1); if(read_bit_2 != NULL) free(read_bit_2); if(read_val_1 != NULL) free(read_val_1); if(read_val_2 != NULL) free(read_val_2); for(r_i = 0; r_i < thread_n; r_i++) { if(read_val1[r_i][0] != NULL) free(read_val1[r_i][0]); if(read_val1[r_i][1] != NULL) free(read_val1[r_i][1]); if(read_val1[r_i] != NULL) free(read_val1[r_i]); } if(read_val1 != NULL) free(read_val1); for(r_i = 0; r_i < thread_n; r_i++) { if(read_val2[r_i][0] != NULL) free(read_val2[r_i][0]); if(read_val2[r_i][1] != NULL) free(read_val2[r_i][1]); if(read_val2[r_i] != NULL) free(read_val2[r_i]); } if(read_val2 != NULL) free(read_val2); #ifdef QUAL_FILT_LV for(r_i = 0; r_i < thread_n; r_i++) { if(qual_filt_lv1[r_i][0] != NULL) free(qual_filt_lv1[r_i][0]); if(qual_filt_lv1[r_i][1] != NULL) free(qual_filt_lv1[r_i][1]); if(qual_filt_lv1[r_i] != NULL) free(qual_filt_lv1[r_i]); } if(qual_filt_lv1 != NULL) free(qual_filt_lv1); for(r_i = 0; r_i < thread_n; r_i++) { if(qual_filt_lv2[r_i][0] != NULL) free(qual_filt_lv2[r_i][0]); if(qual_filt_lv2[r_i][1] != NULL) free(qual_filt_lv2[r_i][1]); if(qual_filt_lv2[r_i] != NULL) free(qual_filt_lv2[r_i]); } if(qual_filt_lv2 != NULL) free(qual_filt_lv2); #endif #ifdef PR_COV_FILTER if(cov_filt_f != NULL) free(cov_filt_f); #endif #endif if(buffer_ref_seq != NULL) free(buffer_ref_seq); if(buffer_seq != NULL) free(buffer_seq); if(buffer_seqf != NULL) free(buffer_seqf); //if(buffer_edge != NULL) free(buffer_edge); if(buffer_p != NULL) free(buffer_p); if(buffer_pp != NULL) free(buffer_pp); if(buffer_hash_g != NULL) free(buffer_hash_g); if(buffer_kmer_g != NULL) free(buffer_kmer_g); if(buffer_off_g != NULL) free(buffer_off_g); #ifdef KSW_ALN_PAIR for(r_i = 0; r_i < thread_n; r_i++) if(ali_ref_seq2[r_i] != NULL) free(ali_ref_seq2[r_i]); if(ali_ref_seq2 != NULL) free(ali_ref_seq2); for(r_i = 0; r_i < thread_n; r_i++) if(read_char2[r_i] != NULL) free(read_char2[r_i]); if(read_char2 != NULL) free(read_char2); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_kl1[r_i] != NULL) free(op_dm_kl1[r_i]); if(op_dm_kl1 != NULL) free(op_dm_kl1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_kr1[r_i] != NULL) free(op_dm_kr1[r_i]); if(op_dm_kr1 != NULL) free(op_dm_kr1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_kl2[r_i] != NULL) free(op_dm_kl2[r_i]); if(op_dm_kl2 != NULL) free(op_dm_kl2); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_kr2[r_i] != NULL) free(op_dm_kr2[r_i]); if(op_dm_kr2 != NULL) free(op_dm_kr2); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_kl1[r_i] != NULL) free(ops_dm_kl1[r_i]); if(ops_dm_kl1 != NULL) free(ops_dm_kl1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_kr1[r_i] != NULL) free(ops_dm_kr1[r_i]); if(ops_dm_kr1 != NULL) free(ops_dm_kr1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_kl2[r_i] != NULL) free(ops_dm_kl2[r_i]); if(ops_dm_kl2 != NULL) free(ops_dm_kl2); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_kr2[r_i] != NULL) free(ops_dm_kr2[r_i]); if(ops_dm_kr2 != NULL) free(ops_dm_kr2); if(mat != NULL) free(mat); #endif #ifdef MAPPING_QUALITY for(r_i = 0; r_i < thread_n; r_i++) { if(mp_subs1[r_i][0] != NULL) free(mp_subs1[r_i][0]); if(mp_subs1[r_i][1] != NULL) free(mp_subs1[r_i][1]); if(mp_subs1[r_i] != NULL) free(mp_subs1[r_i]); } if(mp_subs1 != NULL) free(mp_subs1); for(r_i = 0; r_i < thread_n; r_i++) { if(mp_subs2[r_i][0] != NULL) free(mp_subs2[r_i][0]); if(mp_subs2[r_i][1] != NULL) free(mp_subs2[r_i][1]); if(mp_subs2[r_i] != NULL) free(mp_subs2[r_i]); } if(mp_subs2 != NULL) free(mp_subs2); if(sub_t != NULL) free(sub_t); #endif return 0; } #ifdef R_W_LOCK int seed_ali_core(int read_seq_core, uint8_t tid) #else int seed_ali_core(uint32_t seqn, uint8_t tid) #endif { uint8_t rc_i = 0; uint8_t un_ii = 0; uint8_t lv_ref_length_re1 = 0; uint8_t lv_ref_length_re2 = 0; uint8_t q_n1 = 0; uint8_t q_n2 = 0; uint8_t c_m_f = 0; uint8_t end1_uc_f = 0; uint8_t end2_uc_f = 0; uint8_t nuc1_f = 0; uint8_t nuc2_f = 0; uint8_t b_t_n_r = 0; uint8_t re_d = 0; uint8_t single_lv_re = 0; uint8_t rc_ii = 0; uint8_t unmatch[2][2]; uint16_t max_mismatch = 0; //uint8_t flow_f = 0; char cigar_p1[MAX_LV_CIGARCOM]; char cigar_p2[MAX_LV_CIGARCOM]; uint16_t f_cigar[MAX_LV_CIGAR]; char sam_seq1[MAX_READLEN] = {}; char sam_seq2[MAX_READLEN] = {}; char cigarBuf1[MAX_LV_CIGAR] = {}; char cigarBuf2[MAX_LV_CIGAR] = {}; char str_o[MAX_LV_CIGAR]; char b_cigar[MAX_LV_CIGAR]; char* cp1 = NULL; char* cp2 = NULL; char* seq1p = NULL; char* seq2p = NULL; char* pch = NULL; char* saveptr = NULL; char* cigar_m_1 = NULL; char* cigar_m_2 = NULL; uint16_t ref_copy_num = 0; uint16_t ref_copy_num1 = 0; uint16_t ref_copy_num2 = 0; uint16_t ref_copy_num_1 = 0; uint16_t ref_copy_num_2 = 0; uint16_t f_cigarn = 0; uint16_t read_bit_char1 = 0; uint16_t read_bit_char2 = 0; int16_t rst_i = 0; uint16_t s_m_t = 0; uint16_t read_b_i = 0; uint16_t f_c = 0; uint16_t pchl = 0; uint16_t f_i = 0; uint16_t s_o = 0; uint16_t snt = 0; uint16_t d_n1 = 0; uint16_t i_n1 = 0; uint16_t no1_tmp = 0; uint16_t no2_tmp = 0; uint16_t read_length = 0; uint16_t read_length1 = 0; uint16_t read_length2 = 0; uint16_t read_length_1 = 0; uint16_t read_length_2 = 0; uint16_t dm_i = 0; uint32_t read_length_a1 = 0; uint32_t read_length_a2 = 0; uint32_t seqi = 0; uint32_t v_cnt = 0; uint32_t vs_cnt = 0; uint32_t ref_copy_num_chars = 0; uint32_t ref_copy_num_chars1 = 0; uint32_t ref_copy_num_chars2 = 0; uint32_t ref_copy_num_chars_1 = 0; uint32_t ref_copy_num_chars_2 = 0; uint32_t r_i = 0; uint32_t psp_i = 0; uint32_t d_l1 = 0; uint32_t d_l2 = 0; uint32_t d_r1 = 0; uint32_t d_r2 = 0; uint32_t mis_c_n = 0; uint32_t mis_c_n_filt = 0; uint32_t xa_i = 0; uint32_t xa_i_1 = 0; uint32_t xa_i_2 = 0; uint32_t v_cnt_i = 0; uint32_t va_cnt_i = 0; uint32_t sam_flag1 = 0; uint32_t sam_flag2 = 0; uint32_t seed1_i = 0; uint32_t seed2_i = 0; uint32_t sam_seq_i = 0; uint32_t rc_f = 0; uint32_t max_pair_score = 0; uint32_t seed_posn_filter = 0; #ifdef QUALS_CHECK uint8_t error_f = 0; #endif int dm_op_p = 0; int s_r_o_l1 = 0; int s_r_o_r1 = 0; int s_r_o_l2 = 0; int s_r_o_r2 = 0; int lv_re1f = 0; int lv_re1b = 0; int lv_re2f = 0; int lv_re2b = 0; int chr_re = 0; int chr_re1 = 0; int chr_re2 = 0; int mid = 0; int low = 0; int high = 0; int m_m_n = 0; int sn = 0; int dm12 = 0; int dm1 = 0; int dm2 = 0; int dm_l1 = 0; int dm_r1 = 0; int dm_l2 = 0; int dm_r2 = 0; int dmt1 = 0; int dmt2 = 0; int lv_dmt1 = 0; int lv_dmt2 = 0; int ld1 = 0; int rd1 = 0; int ld2 = 0; int rd2 = 0; int ksw_re = 0; int cmp_re = 0; int q_rear_i = 0; int q_rear1 = 0; int q_rear2 = 0; int cache_dml1[MAX_Q_NUM]; int cache_dml2[MAX_Q_NUM]; int cache_dmr1[MAX_Q_NUM]; int cache_dmr2[MAX_Q_NUM]; int cache_dis1[MAX_Q_NUM]; int cache_dis2[MAX_Q_NUM]; int cache_kl1[MAX_Q_NUM]; int cache_kr1[MAX_Q_NUM]; int cache_kl2[MAX_Q_NUM]; int cache_kr2[MAX_Q_NUM]; int nm_score1 = 0; int nm_score2 = 0; uint32_t spa_i[2][2]; uint64_t c_tmp = 0; uint64_t xor_tmp = 0; uint64_t ref_tmp_ori = 0; uint64_t ref_tmp_ori2 = 0; uint64_t tran_tmp_p = 0; uint64_t tran_tmp = 0; int64_t sam_cross = 0; int64_t sam_pos1 = 0; int64_t sam_pos2 = 0; uint64_t cache_end1[MAX_Q_NUM][MAX_REF_SEQ_C]; uint64_t cache_end2[MAX_Q_NUM][MAX_REF_SEQ_C]; uint64_t low_mask = 0; uint16_t* sub_mask = NULL; uint64_t* ex_d_mask = NULL; #ifdef SEED_FILTER_LENGTH uint16_t seed_no[2][2]; uint16_t max_read_length[2][2]; uint16_t max_sets_n[2][2]; uint16_t off_i = 0; #endif int64_t bit_char_i = 0; int64_t bit_char_i_ref = 0; cnt_re cnt; #ifdef ANCHOR_HASH_ALI uint8_t ori_i = 0; uint16_t tra_i; uint8_t base_re = 0; uint8_t anchor_hash_i = 0; uint16_t des_i = 0; uint16_t print_i; uint16_t array_index; uint16_t char_i = 0; uint16_t buffer_i = 0; uint16_t seed_length = 0; uint16_t max_seed_length = 0; uint16_t lv_k = 0; uint16_t lv_k1 = 0; uint16_t lv_k2 = 0; uint16_t lv_k_1 = 0; uint16_t lv_k_2 = 0; uint32_t read_k_p = 0; uint32_t read_k_t = 0; uint32_t anchor_mask = 0; uint32_t array_i = 0; uint32_t array_i_p = 0; uint32_t anchor_ref = 0; uint32_t r_b_v = 0; uint32_t max_right = 0; int left_i = 0; int right_i = 0; uint64_t* ori = NULL; anchor_mask = ((uint32_t )1 << k_anchor_b) - 1; uint16_t* anchor_hash_p = NULL; uint8_t* anchor_array_p = NULL; uint16_t* anchor_point_p = NULL; uint16_t* anchor_pos_p = NULL; #endif seed_pa* seed_pr1 = NULL; seed_pa* seed_pr2 = NULL; seed_pa* seed_pr[2][2]; seed_pr[0][0] = NULL; seed_pr[0][1] = NULL; seed_pr[1][0] = NULL; seed_pr[1][1] = NULL; //for # position int16_t pound_pos1_f_forward = 0; int16_t pound_pos1_f_reverse = 0; int16_t pound_pos1_r_forward = 0; int16_t pound_pos1_r_reverse = 0; int16_t pound_pos2_f_forward = 0; int16_t pound_pos2_f_reverse = 0; int16_t pound_pos2_r_forward = 0; int16_t pound_pos2_r_reverse = 0; int16_t pound_mis = 0; int16_t pound_pos_1_f = 0; int16_t pound_pos_1_r = 0; int16_t pound_pos_2_f = 0; int16_t pound_pos_2_r = 0; int16_t lv_up_left = 0; int16_t lv_up_right = 0; int16_t lv_down_right = 0; int16_t lv_down_left = 0; int16_t dm_cir_1 = 0; int16_t dm_cir_2 = 0; int16_t dm_cir = 0; int16_t dm_cir_min = 0; int16_t cache_dm_cir1[MAX_Q_NUM]; int16_t cache_dm_cir2[MAX_Q_NUM]; int16_t read_pos_re = 0; int16_t read_pos_end_re = 0; int16_t read_pos_start_num = 0; int16_t read_pos_end_num = 0; int16_t rst_i_1 = 0; int16_t m_n_f = 0; int16_t m_n_b = 0; int16_t s_r_o_l = 0; int16_t s_r_o_r = 0; uint8_t cir_n = 0; #ifdef KSW_ALN_PAIR int band_with = 33;//100 int zdrop = 0;//100 int end_bonus = 5; int tle; int gtle; int gscore; int max_off; #endif #ifdef QUAL_FILT uint64_t* qual_filt_1 = NULL; uint64_t* qual_filt_2 = NULL; uint8_t qual_filt_fix = 55; #endif #ifdef QUAL_FILT_LV uint8_t* qual_filt_lv_1 = NULL; uint8_t* qual_filt_lv_2 = NULL; uint8_t* qual_filt_lv_1_o = NULL; uint8_t* qual_filt_lv_2_o = NULL; uint16_t mis_n1 = 0; uint16_t mis_n2 = 0; #endif uint16_t s_offset1 = 0; uint16_t s_offset2 = 0; #ifdef ALTER_DEBUG uint16_t seed_length1 = 0; uint16_t seed_length2 = 0; #endif #ifdef MAPPING_QUALITY float m_sub_tmp = 0; #endif #ifdef UNPIPATH_OFF_K20 uint64_t pos_l = 0; uint64_t posi = 0; uint64_t x = 0; uint64_t ksw_s = 0; uint64_t ksw_e = 0; uint64_t base_i = 0; uint64_t base_i_off_l = 0; uint64_t base_i_off_r = 0; #else uint32_t pos_l = 0; uint32_t posi = 0; uint32_t x = 0; uint32_t ksw_s = 0; uint32_t ksw_e = 0; uint32_t base_i = 0; uint32_t base_i_off_l = 0; uint32_t base_i_off_r = 0; #endif uint64_t low_mask_1 = 0; uint64_t low_mask_2 = 0; #ifdef READN_RANDOM_SEED char tmp_char; uint16_t readn_re1 = 0; uint16_t readn_re2 = 0; #endif #ifdef CIGAR_LEN_ERR int cigar_len = 0; int cigar_len_tmp = 0; int cigar_len_re = 0; uint16_t pchl_tmp = 0; uint16_t s_o_tmp = 0; char* pch_tmp = NULL; char* saveptr_tmp = NULL; char cigar_tmp[MAX_LV_CIGARCOM]; #endif uint8_t qual_flag = 0; #ifdef REDUCE_ANCHOR int ls = 0; int rs = 0; uint8_t rcs = 0; uint16_t tra1_i = 0; uint16_t tra2_i = 0; uint16_t anchor_n1 = 0; uint16_t anchor_n2 = 0; uint8_t other_end_flag = 0; uint16_t op_mask[MAX_REDUCE_ANCHOR_NUM]; uint16_t ops_mask[MAX_REDUCE_ANCHOR_NUM]; #endif #ifdef ANCHOR_LV_S int16_t s_offset_l = 0; int16_t s_offset_r = 0; #endif uint64_t* op_vector_seq1_tmp = NULL; uint16_t v_cnt_i_tmp = 0; #ifdef FIX_SV uint16_t tra_i_n = 0; uint8_t sv_add = 0; #endif #ifdef FIX_SA uint8_t op_rc_tmp = 0; uint16_t sv_s_len = 0; uint16_t sv_s_len_p = 0; #endif #ifndef R_W_LOCK for(seqi = 0; seqi < seqn; seqi++) #else if(1) #endif { #ifndef R_W_LOCK #ifdef PTHREAD_USE if ((seqi % thread_n) != tid) continue; #endif #else seqi = read_seq_core; #endif read_length1 = seqio[seqi].read_length1; read_length2 = seqio[seqi].read_length2; lv_k1 = (read_length1 * lv_rate) + 1; lv_k2 = (read_length2 * lv_rate) + 1; if((insert_dis < read_length1) || (insert_dis < read_length2)) { fprintf(stderr, "Input error: wrong -u or -f\n"); exit(1); } end_dis1[tid] = insert_dis - read_length2; end_dis2[tid] = insert_dis - read_length1; read_length_a1 = read_length1 - 1; read_length_a2 = read_length2 - 1; f_cigarn = (read_length1 > read_length2) ? read_length1: read_length2; f_cigar[f_cigarn] = '\0'; //sprintf(cigar_m1[tid],"%uM\0",read_length1); //sprintf(cigar_m2[tid],"%uM\0",read_length2); sprintf(cigar_m1[tid],"%uM",read_length1); sprintf(cigar_m2[tid],"%uM",read_length2); //for bit operation read_bit_char1 = (((uint16_t )((read_length_a1 >> 5) + 1)) << 3); read_bit_char2 = (((uint16_t )((read_length_a2 >> 5) + 1)) << 3); ref_copy_num1 = ((read_length_a1) >> 5) + 3; ref_copy_num_chars1 = (ref_copy_num1 << 3); lv_ref_length_re1 = (read_length1 & 0X1f); for(r_i = 0; r_i <= 32 - lv_ref_length_re1; r_i++) { ex_d_mask1[tid][r_i] = bit_assi[lv_ref_length_re1 + r_i]; sub_mask1[tid][r_i] = ref_copy_num1 - 2; } for(r_i = 33 - lv_ref_length_re1; r_i <= 32; r_i++) { ex_d_mask1[tid][r_i] = bit_assi[lv_ref_length_re1 + r_i - 32]; sub_mask1[tid][r_i] = ref_copy_num1 - 1; } low_mask1[tid] = bit_assi[lv_ref_length_re1]; //for bit operation ref_copy_num2 = ((read_length_a2) >> 5) + 3; ref_copy_num_chars2 = (ref_copy_num2 << 3); lv_ref_length_re2 = (read_length2 & 0X1f); for(r_i = 0; r_i <= 32 - lv_ref_length_re2; r_i++) { ex_d_mask2[tid][r_i] = bit_assi[lv_ref_length_re2 + r_i]; sub_mask2[tid][r_i] = ref_copy_num2 - 2; } for(r_i = 33 - lv_ref_length_re2; r_i <= 32; r_i++) { ex_d_mask2[tid][r_i] = bit_assi[lv_ref_length_re2 + r_i - 32]; sub_mask2[tid][r_i] = ref_copy_num2 - 1; } low_mask2[tid] = bit_assi[lv_ref_length_re2]; max_pair_score = (uint32_t )(((float )(read_length1 + read_length2)) * max_pair_score_r); cov_a_n[tid][0] = ((read_length_a1) >> 6) + 1;//2 cov_a_n[tid][1] = ((read_length_a2) >> 6) + 1; max_mismatch1[tid] = (uint16_t )(((float )read_length1) * mis_match_r); max_mismatch2[tid] = (uint16_t )(((float )read_length2) * mis_match_r); max_mismatch1_single[tid] = (uint16_t )(((float )read_length1) * mis_match_r_single); max_mismatch2_single[tid] = (uint16_t )(((float )read_length2) * mis_match_r_single); memset(read_bit1[tid][0], 0, read_bit_char1); memset(read_bit1[tid][1], 0, read_bit_char1); memset(read_bit2[tid][0], 0, read_bit_char2); memset(read_bit2[tid][1], 0, read_bit_char2); r_i = 0; while ((seqio[seqi].read_seq1)[r_i]) { #ifdef READN_RANDOM_SEED tmp_char = (seqio[seqi].read_seq1)[r_i]; if(tmp_char == 'N') { readn_re1 = readn_cnt & 0X3ff; readn_re2 = readn_cnt & 0Xf; c_tmp = ((random_buffer_readn[readn_re1] >> (readn_re2 << 1)) & 0X3); readn_cnt++; } else c_tmp = charToDna5n[tmp_char]; #else c_tmp = charToDna5n[(seqio[seqi].read_seq1)[r_i]]; #endif #ifdef ALI_LV read_val1[tid][0][r_i] = c_tmp; read_val1[tid][1][read_length_a1 - r_i] = c_tmp ^ 0X3; #endif read_bit1[tid][0][r_i >> 5] |= (((uint64_t )c_tmp) << ((31 - (r_i & 0X1f)) << 1)); read_bit1[tid][1][(read_length_a1 - r_i) >> 5] |= (((uint64_t )(c_tmp ^ 0X3)) << ((31 - ((read_length_a1 - r_i) & 0X1f)) << 1)); r_i++; } r_i = 0; while ((seqio[seqi].read_seq2)[r_i]) { #ifdef READN_RANDOM_SEED tmp_char = (seqio[seqi].read_seq2)[r_i]; if(tmp_char == 'N') { readn_re1 = readn_cnt & 0X3ff; readn_re2 = readn_cnt & 0Xf; c_tmp = ((random_buffer_readn[readn_re1] >> (readn_re2 << 1)) & 0X3); readn_cnt++; } else c_tmp = charToDna5n[tmp_char]; #else c_tmp = charToDna5n[(seqio[seqi].read_seq2)[r_i]]; #endif #ifdef ALI_LV read_val2[tid][0][r_i] = c_tmp; read_val2[tid][1][read_length_a2 - r_i] = c_tmp ^ 0X3; #endif read_bit2[tid][0][r_i >> 5] |= (((uint64_t )c_tmp) << ((31 - (r_i & 0X1f)) << 1)); read_bit2[tid][1][(read_length_a2 - r_i) >> 5] |= (((uint64_t )(c_tmp ^ 0X3)) << ((31 - ((read_length_a2 - r_i) & 0X1f)) << 1)); r_i++; } #ifdef QUAL_FILT memset(qual_filt1[tid][0], 0, read_bit_char1); memset(qual_filt1[tid][1], 0, read_bit_char1); memset(qual_filt2[tid][0], 0, read_bit_char2); memset(qual_filt2[tid][1], 0, read_bit_char2); c_tmp = 3; for(r_i = 0; r_i < read_length1; r_i++) { if(seqio[seqi].qual1[r_i] < qual_filt_fix) //'7': 55 63 { qual_filt1[tid][0][r_i >> 5] |= (((uint64_t )c_tmp) << ((31 - (r_i & 0X1f)) << 1)); qual_filt1[tid][1][(read_length_a1 - r_i) >> 5] |= (((uint64_t )c_tmp) << ((31 - ((read_length_a1 - r_i) & 0X1f)) << 1)); } } for(r_i = 0; r_i < read_length2; r_i++) { if(seqio[seqi].qual2[r_i] < qual_filt_fix) //'7': 55 63 { qual_filt2[tid][0][r_i >> 5] |= (((uint64_t )c_tmp) << ((31 - (r_i & 0X1f)) << 1)); qual_filt2[tid][1][(read_length_a2 - r_i) >> 5] |= (((uint64_t )c_tmp) << ((31 - ((read_length_a2 - r_i) & 0X1f)) << 1)); } } for(r_i = 0; r_i < (read_length1 >> 5) + 1; r_i++) qual_filt1[tid][0][r_i] = ~qual_filt1[tid][0][r_i]; for(r_i = 0; r_i < (read_length1 >> 5) + 1; r_i++) qual_filt1[tid][1][r_i] = ~qual_filt1[tid][1][r_i]; for(r_i = 0; r_i < (read_length2 >> 5) + 1; r_i++) qual_filt2[tid][0][r_i] = ~qual_filt2[tid][0][r_i]; for(r_i = 0; r_i < (read_length2 >> 5) + 1; r_i++) qual_filt2[tid][1][r_i] = ~qual_filt2[tid][1][r_i]; #ifdef QUAL_FILT_LV for(r_i = 0; r_i < read_length1; r_i++) { if(seqio[seqi].qual1[r_i] < qual_filt_fix) qual_filt_lv1[tid][0][r_i] = 0; else qual_filt_lv1[tid][0][r_i] = 3; } for(r_i = 0; r_i < read_length1; r_i++) { if(seqio[seqi].qual1[r_i] < qual_filt_fix) qual_filt_lv1[tid][1][read_length_a1 - r_i] = 0; else qual_filt_lv1[tid][1][read_length_a1 - r_i] = 3; } for(r_i = 0; r_i < read_length2; r_i++) { if(seqio[seqi].qual2[r_i] < qual_filt_fix) qual_filt_lv2[tid][0][r_i] = 0; else qual_filt_lv2[tid][0][r_i] = 3; } for(r_i = 0; r_i < read_length2; r_i++) { if(seqio[seqi].qual2[r_i] < qual_filt_fix) qual_filt_lv2[tid][1][read_length_a2 - r_i] = 0; else qual_filt_lv2[tid][1][read_length_a2 - r_i] = 3; } #endif #endif #ifdef MAPPING_QUALITY for(r_i = 0; r_i < read_length1; r_i++) { m_sub_tmp = mp_sub_bp[seqio[seqi].qual1[r_i]]; mp_subs1[tid][0][r_i] = m_sub_tmp; mp_subs1[tid][1][read_length_a1 - r_i] = m_sub_tmp; } for(r_i = 0; r_i < read_length2; r_i++) { m_sub_tmp = mp_sub_bp[seqio[seqi].qual2[r_i]]; mp_subs2[tid][0][r_i] = m_sub_tmp; mp_subs2[tid][1][read_length_a2 - r_i] = m_sub_tmp; } #endif pound_pos1_f_forward = read_length1; pound_pos1_r_forward = read_length1; pound_pos1_f_reverse = 0; pound_pos1_r_reverse = 0; pound_pos2_f_forward = read_length2; pound_pos2_r_forward = read_length2; pound_pos2_f_reverse = 0; pound_pos2_r_reverse = 0; for(r_i = 0; r_i < read_length1; r_i++) if(seqio[seqi].qual1[r_i] == '#') { pound_pos1_f_forward = r_i; pound_pos1_r_reverse = read_length1 - r_i; break; } for(r_i = 0; r_i < read_length2; r_i++) if(seqio[seqi].qual2[r_i] == '#') { pound_pos2_f_forward = r_i; pound_pos2_r_reverse = read_length2 - r_i; break; } de_m_p[tid] = 1; de_m_p_o[tid] = 1; seed_l[tid] = seed_l_max; #ifdef PAIR_SEED_LENGTH_FILT max_lengtht[tid] = 0; #endif rc_f = 0; #ifdef PR_COV_FILTER cov_filt_f[tid] = 0; #endif #ifdef PR_SINGLE seed_re_r[tid] = 0; #endif #ifdef TER_J dm_op_p = 0; v_cnt_p = 0; #endif dm_op_p = MAX_OP_SCORE; #ifdef ALTER_DEBUG rep_go[tid] = 1; #endif cir_n = 1; while(cir_n <= cir_fix_n) { dm_op[tid] = MAX_OP_SCORE; dm_ops[tid] = MAX_OP_SCORE; v_cnt = 0; vs_cnt = 0; mat_posi[tid] = 0; rc_f = 0Xffffffff; dm_cir_min = 0Xfff; unmatch[0][0] = 0; unmatch[0][1] = 0; unmatch[1][0] = 0; unmatch[1][1] = 0; #ifdef PAIR_RANDOM if(cir_n == 1) { pos_ren[0][0][tid] = 0; pos_ren[0][1][tid] = 0; pos_ren[1][0][tid] = 0; pos_ren[1][1][tid] = 0; } #endif for(rc_i = 0; rc_i < 2; rc_i++) { rc_cov_f[tid] = 0; #ifdef SEED_FILTER_LENGTH max_read_length[rc_i][rc_i] = 0; #ifdef UNPIPATH_OFF_K20 if((seed_pr[rc_i][rc_i] = single_seed_reduction_core_filter64(seedpa1[rc_i][tid], read_bit1[tid][rc_i], read_val1[tid][rc_i], &(spa_i[rc_i][rc_i]), &(seed_set_pos[rc_i][rc_i][tid]), &(pos_ren[rc_i][rc_i][tid]), tid, read_length1, &(seed_no[rc_i][rc_i]), &(max_read_length[rc_i][rc_i]))) == NULL) #else if((seed_pr[rc_i][rc_i] = single_seed_reduction_core_filter(seedpa1[rc_i][tid], read_bit1[tid][rc_i], read_val1[tid][rc_i], &(spa_i[rc_i][rc_i]), &(seed_set_pos[rc_i][rc_i][tid]), &(pos_ren[rc_i][rc_i][tid]), tid, read_length1, &(seed_no[rc_i][rc_i]), &(max_read_length[rc_i][rc_i]))) == NULL) #endif #else if((seed_pr[rc_i][rc_i] = single_seed_reduction_core(seedpa1[rc_i][tid], read_bit1[tid][rc_i], read_val1[tid][rc_i], &(spa_i[rc_i][rc_i]), &(seed_set_pos[rc_i][rc_i][tid]), &(pos_ren[rc_i][rc_i][tid]), tid, read_length1)) == NULL) #endif { #ifdef UNMATCH_SINGLE_END unmatch[rc_i][rc_i] = 1; #endif #ifdef UNMATCH_SINGLE_END_MIS unmatch[rc_i][rc_i] = 1; #endif } rc_cov_f[tid] = 1; #ifdef SEED_FILTER_LENGTH max_read_length[rc_i][1 - rc_i] = 0; #ifdef UNPIPATH_OFF_K20 if((seed_pr[rc_i][1 - rc_i] = single_seed_reduction_core_filter64(seedpa2[rc_i][tid], read_bit2[tid][1 - rc_i], read_val2[tid][1 - rc_i], &(spa_i[rc_i][1 - rc_i]), &(seed_set_pos[rc_i][1 - rc_i][tid]), &(pos_ren[rc_i][1 - rc_i][tid]), tid, read_length2, &(seed_no[rc_i][1 - rc_i]), &(max_read_length[rc_i][1 - rc_i]))) == NULL) #else if((seed_pr[rc_i][1 - rc_i] = single_seed_reduction_core_filter(seedpa2[rc_i][tid], read_bit2[tid][1 - rc_i], read_val2[tid][1 - rc_i], &(spa_i[rc_i][1 - rc_i]), &(seed_set_pos[rc_i][1 - rc_i][tid]), &(pos_ren[rc_i][1 - rc_i][tid]), tid, read_length2, &(seed_no[rc_i][1 - rc_i]), &(max_read_length[rc_i][1 - rc_i]))) == NULL) #endif #else if((seed_pr[rc_i][1 - rc_i] = single_seed_reduction_core(seedpa2[rc_i][tid], read_bit2[tid][1 - rc_i], read_val2[tid][1 - rc_i], &(spa_i[rc_i][1 - rc_i]), &(seed_set_pos[rc_i][1 - rc_i][tid]), &(pos_ren[rc_i][1 - rc_i][tid]), tid, read_length2)) == NULL) #endif { #ifdef UNMATCH_SINGLE_END unmatch[rc_i][1 - rc_i] = 1; #endif #ifdef UNMATCH_SINGLE_END_MIS unmatch[rc_i][1 - rc_i] = 1; #endif } if((seed_pr[rc_i][rc_i] != NULL) && (seed_pr[rc_i][1 - rc_i] != NULL)) { #ifdef UNPIPATH_OFF_K20 merge_pair_end64(spa_i[rc_i][0], spa_i[rc_i][1], seed_pr[rc_i][0], seed_pr[rc_i][1], seed_set_pos[rc_i][0][tid], seed_set_pos[rc_i][1][tid], rc_i, tid); #else merge_pair_end(spa_i[rc_i][0], spa_i[rc_i][1], seed_pr[rc_i][0], seed_pr[rc_i][1], seed_set_pos[rc_i][0][tid], seed_set_pos[rc_i][1][tid], rc_i, tid); #endif if(rc_i == 0) rc_f = mat_posi[tid]; } } if(de_m_p[tid] == 1) { seed_l[tid] -= seed_step; } else { no1_tmp = 0Xffff; no2_tmp = 0Xffff; for(r_i = 0; r_i < mat_posi[tid]; r_i++) { seed1_i = seed_no1[tid][r_i]; seed2_i = seed_no2[tid][r_i]; if(mat_rc[tid][r_i] == 0) { read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; read_val_1[tid] = read_val1[tid][0]; read_val_2[tid] = read_val2[tid][1]; #ifdef QUAL_FILT qual_filt_1 = qual_filt1[tid][0]; qual_filt_2 = qual_filt2[tid][1]; #endif #ifdef QUAL_FILT_LV qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_2 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; qual_filt_lv_2_o = qual_filt_lv2[tid][0]; #endif seed_pr1 = seed_pr[0][0]; seed_pr2 = seed_pr[0][1]; read_length_1 = read_length1; read_length_2 = read_length2; ref_copy_num_1 = ref_copy_num1; ref_copy_num_2 = ref_copy_num2; ref_copy_num_chars_1 = ref_copy_num_chars1; ref_copy_num_chars_2 = ref_copy_num_chars2; low_mask_1 = low_mask1[tid]; low_mask_2 = low_mask2[tid]; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } if(mat_rc[tid][r_i] == 1) { read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; read_val_1[tid] = read_val2[tid][0]; read_val_2[tid] = read_val1[tid][1]; #ifdef QUAL_FILT qual_filt_1 = qual_filt2[tid][0]; qual_filt_2 = qual_filt1[tid][1]; #endif #ifdef QUAL_FILT_LV qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_2 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; qual_filt_lv_2_o = qual_filt_lv1[tid][0]; #endif seed_pr1 = seed_pr[1][0]; seed_pr2 = seed_pr[1][1]; read_length_1 = read_length2; read_length_2 = read_length1; ref_copy_num_1 = ref_copy_num2; ref_copy_num_2 = ref_copy_num1; ref_copy_num_chars_1 = ref_copy_num_chars2; ref_copy_num_chars_2 = ref_copy_num_chars1; low_mask_1 = low_mask2[tid]; low_mask_2 = low_mask1[tid]; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } #ifdef PAIR_SEED_LENGTH_FILT if(seed_pr1[seed1_i].length + seed_pr2[seed2_i].length < max_lengtht[tid] - length_reducet) continue; #endif if(r_i == rc_f) { no1_tmp = 0Xffff; no2_tmp = 0Xffff; } if(seed1_i != no1_tmp) { //current seed does not cross one unipath if(seed_pr1[seed1_i].ui == 1) { end1_uc_f = 0; nuc1_f = 0; d_l1 = seed_pr1[seed1_i].ref_pos_off; d_r1 = seed_pr1[seed1_i].ref_pos_off_r; } else { end1_uc_f = 1; } q_rear1 = 0; q_n1 = 0; dmt1 = ali_exl; lv_dmt1 = lv_k1; s_r_o_l1 = seed_pr1[seed1_i].s_r_o_l; s_r_o_r1 = seed_pr1[seed1_i].s_r_o_r; #ifdef ALTER_DEBUG seed_length1 = seed_pr1[seed1_i].length; #endif no1_tmp = seed1_i; } if(seed2_i != no2_tmp) { //current seed does not cross one unipath if(seed_pr2[seed2_i].ui == 1) { end2_uc_f = 0; nuc2_f = 0; d_l2 = seed_pr2[seed2_i].ref_pos_off; d_r2 = seed_pr2[seed2_i].ref_pos_off_r; } else { end2_uc_f = 1; } q_rear2 = 0; q_n2 = 0; dmt2 = ali_exl; lv_dmt2 = lv_k2; s_r_o_l2 = seed_pr2[seed2_i].s_r_o_l; s_r_o_r2 = seed_pr2[seed2_i].s_r_o_r; #ifdef ALTER_DEBUG seed_length2 = seed_pr2[seed2_i].length; #endif no2_tmp = seed2_i; } #ifdef ALI_B_V_R //alignment //for end1 if((end1_uc_f == 0) && ((dmt1 <= d_l1) && (dmt1 <= d_r1))) // && (nuc1_f == 0) { if(nuc1_f == 0) { //lv_f1 = 0; pos_l = mat_pos1[tid][r_i] - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars_1); for(rst_i = 0; rst_i < ref_copy_num_1 - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask_1; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars_1); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num_1 - 1] &= low_mask_1; } //exact match mis_c_n = 0; #ifdef QUAL_FILT mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num_1 - 2]; ref_seq_tmp1[tid][ref_copy_num_1 - 2] &= low_mask_1; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num_1 - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch1[tid]) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch1[tid]) break; #endif } ref_seq_tmp1[tid][ref_copy_num_1 - 2] = ref_tmp_ori; if(mis_c_n_filt > max_mismatch1[tid]) { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(s_r_o_l1 + 1, read_char[tid], 33 + s_r_o_l1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_l1, &tle, &gtle, &gscore, &max_off); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length_1; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length_1 + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(read_length_1 - s_r_o_r1, read_char[tid], 32 + read_length_1 - s_r_o_r1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_r1, &tle, &gtle, &gscore, &max_off); dm1 = MAX_OP_SCORE_P1 - (dm_l1 + dm_r1); //read length cannot be more than 1024 ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { #ifdef SPLIT_LV pound_mis = 0; if(pound_pos_1_f >= s_r_o_r1) //1 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f < pound_pos_1_r) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r1; } else if(pound_pos_1_r <= s_r_o_l1 + 1) //5 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_r > 0) { read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l1; lv_down_right = read_length_1; lv_down_left = s_r_o_r1; } else if((pound_pos_1_f <= s_r_o_l1 + 1) && (pound_pos_1_r >= s_r_o_r1)) //2 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i <= s_r_o_l1) && (bit_char_i_ref <= s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f <= s_r_o_l1) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = s_r_o_l1 >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = (s_r_o_l1 & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; } else if((pound_pos_1_f > s_r_o_l1 + 1) && (pound_pos_1_f < s_r_o_r1)) //3 { #ifdef POUND_MIS for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; } else //4 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < s_r_o_l1) && (bit_char_i_ref < s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_l1 > 0) { read_pos_end_num = (s_r_o_l1 - 1) >> 5; read_pos_end_re = ((s_r_o_l1 - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; #ifdef POUND_MODIFY lv_down_left = s_r_o_r1; #else lv_down_left = s_r_o_l1; #endif } #ifdef QUAL_FILT_LV #ifdef QUAL_FILT_LV_MIS for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #ifdef S_DEBUG printf("extension lv1 %u: %u %d %d\n", mat_rc[tid][r_i], lv_dmt1, lv_up_right, lv_up_left); #endif dm_l1 = computeEditDistance_mis(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length_a1 - lv_up_right); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], qual_filt_lv_1 + lv_down_left); dm1 = dm_l1 + dm_r1 + pound_mis; dm_cir_1 = dm_l1 + dm_r1;// + pound_mis #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance_misboth(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], L_mis[tid], qual_filt_lv_1_o + read_length_a1 - lv_up_right, &mis_n1); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance_misboth(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], L_mis[tid], qual_filt_lv_1 + lv_down_left, &mis_n2); dm1 = mis_n1 + mis_n2 + pound_mis; dm_cir_1 = dm_l1 + dm_r1;// + pound_mis #endif ld1 = s_r_o_l1; rd1 = s_r_o_r1; #else #ifdef LAST_CIRCLE_NOPOUND pound_mis = 0; #endif for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid]); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid]); dm1 = dm_l1 + dm_r1 + pound_mis; dm_cir_1 = dm_l1 + dm_r1;// + pound_mis ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif #endif } } else { dm1 = mis_c_n; dm_cir_1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch1[tid] - 1) dmt1 = 0; } else { dm1 = MAX_EDIT_SCORE; dm_cir_1 = MAX_EDIT_SCORE; } nuc1_f = 1; } } else { pos_l = mat_pos1[tid][r_i] - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars_1); for(rst_i = 0; rst_i < ref_copy_num_1 - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask_1; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars_1); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num_1 - 1] &= low_mask_1; } //trim the beginning and end of the current ref seq based on current minimum edit distance dm_t s_m_t = sub_mask1[tid][dmt1]; ref_seq_tmp1[tid][0] &= bit_tran[dmt1]; ref_seq_tmp1[tid][s_m_t] &= ex_d_mask1[tid][dmt1]; //traverse and check whether there is an existing seq that is as same as current new ref seq c_m_f = 0; for(q_rear_i = q_rear1 - 1; q_rear_i >= 0; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask1[tid][dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment //lv_f1 = cache_lvf1[q_rear_i]; dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; dm_cir_1 = cache_dm_cir1[q_rear_i]; #ifdef KSW_ALN_PAIR if(local_ksw) { dm_l1 = cache_kl1[q_rear_i]; dm_r1 = cache_kr1[q_rear_i]; } #endif c_m_f = 1; break; } } if((q_n1 > MAX_Q_NUM) && (q_rear_i < 0)) { for(q_rear_i = MAX_Q_NUM - 1; q_rear_i >= q_rear1; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask1[tid][dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment //lv_f1 = cache_lvf1[q_rear_i]; dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; dm_cir_1 = cache_dm_cir1[q_rear_i]; #ifdef KSW_ALN_PAIR if(local_ksw) { dm_l1 = cache_kl1[q_rear_i]; dm_r1 = cache_kr1[q_rear_i]; } #endif c_m_f = 1; break; } } } //do not find the seq in cache, exact match or lv and add into cache if(c_m_f == 0) { //exact match mis_c_n = 0; #ifdef QUAL_FILT mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num_1 - 2]; ref_seq_tmp1[tid][ref_copy_num_1 - 2] &= low_mask_1; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num_1 - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch1[tid]) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch1[tid]) break; #endif //mis_c_n += popcount_3(ref_seq_tmp1[rst_i] ^ read_bit_1[read_b_i]); } ref_seq_tmp1[tid][ref_copy_num_1 - 2] = ref_tmp_ori; //lv if(mis_c_n_filt > max_mismatch1[tid]) { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(s_r_o_l1 + 1, read_char[tid], 33 + s_r_o_l1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_l1, &tle, &gtle, &gscore, &max_off); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length_1; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length_1 + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(read_length_1 - s_r_o_r1, read_char[tid], 32 + read_length_1 - s_r_o_r1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_r1, &tle, &gtle, &gscore, &max_off); dm1 = MAX_OP_SCORE_P1 - (dm_l1 + dm_r1); //read length cannot be more than 1024 ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { #ifdef SPLIT_LV pound_mis = 0; if(pound_pos_1_f >= s_r_o_r1) //1 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f < pound_pos_1_r) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r1; } else if(pound_pos_1_r <= s_r_o_l1 + 1) //5 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_r > 0) { read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l1; lv_down_right = read_length_1; lv_down_left = s_r_o_r1; } else if((pound_pos_1_f <= s_r_o_l1 + 1) && (pound_pos_1_r >= s_r_o_r1)) //2 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i <= s_r_o_l1) && (bit_char_i_ref <= s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f <= s_r_o_l1) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = s_r_o_l1 >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = (s_r_o_l1 & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; } else if((pound_pos_1_f > s_r_o_l1 + 1) && (pound_pos_1_f < s_r_o_r1)) //3 { #ifdef POUND_MIS for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; } else //pound_pos_1_r > s_r_o_l1) && (pound_pos_1_r < s_r_o_r1)//4 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < s_r_o_l1) && (bit_char_i_ref < s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_l1 > 0) { read_pos_end_num = (s_r_o_l1 - 1) >> 5; read_pos_end_re = ((s_r_o_l1 - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; #ifdef POUND_MODIFY lv_down_left = s_r_o_r1; #else lv_down_left = s_r_o_l1; #endif } #ifdef QUAL_FILT_LV #ifdef QUAL_FILT_LV_MIS for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance_mis(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length_a1 - lv_up_right); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], qual_filt_lv_1 + lv_down_left); dm1 = dm_l1 + dm_r1 + pound_mis; dm_cir_1 = dm_l1 + dm_r1;// + pound_mis #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance_misboth(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], L_mis[tid], qual_filt_lv_1_o + read_length_a1 - lv_up_right, &mis_n1); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance_misboth(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], L_mis[tid], qual_filt_lv_1 + lv_down_left, &mis_n2); dm1 = mis_n1 + mis_n2 + pound_mis; dm_cir_1 = dm_l1 + dm_r1;// + pound_mis #endif ld1 = s_r_o_l1; rd1 = s_r_o_r1; #else #ifdef LAST_CIRCLE_NOPOUND pound_mis = 0; #endif for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid]); //lv_x_r = (dm_l1 == -1) ? lv_dmt1 : lv_dmt1 - dm_l1; for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid]); dm1 = dm_l1 + dm_r1 + pound_mis; dm_cir_1 = dm_l1 + dm_r1;// + pound_mis ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif #endif } } else { dm1 = mis_c_n; dm_cir_1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch1[tid] - 1) dmt1 = 0; } else { dm1 = MAX_EDIT_SCORE; dm_cir_1 = MAX_EDIT_SCORE; } //add the ref sequence at the end of queue memcpy(cache_end1[q_rear1], ref_seq_tmp1[tid], ref_copy_num_chars_1); cache_dis1[q_rear1] = dm1; cache_dml1[q_rear1] = ld1; cache_dmr1[q_rear1] = rd1; cache_dm_cir1[q_rear1] = dm_cir_1; #ifdef KSW_ALN_PAIR if(local_ksw) { cache_kl1[q_rear1] = dm_l1; cache_kr1[q_rear1] = dm_r1; } #endif q_rear1 = ((q_rear1 + 1) & 0X1f); ++q_n1; //add edit distance } } //for end2 if((end2_uc_f == 0) && ((dmt2 <= d_l2) && (dmt2 <= d_r2))) // && (nuc2_f == 0) { if(nuc2_f == 0) { pos_l = mat_pos2[tid][r_i] - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp2[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars_2); for(rst_i = 0; rst_i < ref_copy_num_2 - 1; rst_i++) { tran_tmp = (ref_seq_tmp2[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp2[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp2[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp2[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp2[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp2[tid][rst_i] &= low_mask_2; } else { memcpy(ref_seq_tmp2[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars_2); //clear the lowest n bit ref_seq_tmp2[tid][ref_copy_num_2 - 1] &= low_mask_2; } //exact match mis_c_n = 0; #ifdef QUAL_FILT mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp2[tid][ref_copy_num_2 - 2]; ref_seq_tmp2[tid][ref_copy_num_2 - 2] &= low_mask_2; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num_2 - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp2[tid][rst_i] ^ read_bit_2[tid][read_b_i]; #ifdef QUAL_FILT mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_2[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch2[tid]) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch2[tid]) break; #endif } ref_seq_tmp2[tid][ref_copy_num_2 - 2] = ref_tmp_ori; //lv if(mis_c_n_filt > max_mismatch2[tid]) { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR for(bit_char_i = s_r_o_l2, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l2, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(s_r_o_l2 + 1, read_char[tid], 33 + s_r_o_l2, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r2 - s_r_o_l2, &dm_l2, &tle, &gtle, &gscore, &max_off); for(bit_char_i = s_r_o_r2, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r2, read_b_i = 0; bit_char_i < read_length_2 + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(read_length_2 - s_r_o_r2, read_char[tid], 32 + read_length_2 - s_r_o_r2, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r2 - s_r_o_l2, &dm_r2, &tle, &gtle, &gscore, &max_off); dm2 = MAX_OP_SCORE_P2 - (dm_l2 + dm_r2); //read length cannot be more than 1024 ld2 = s_r_o_l2; rd2 = s_r_o_r2; #endif } else { #ifdef SPLIT_LV pound_mis = 0; if(pound_pos_2_f >= s_r_o_r2) //1 { #ifdef POUND_MIS for(bit_char_i = pound_pos_2_f, bit_char_i_ref = pound_pos_2_f + 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_2_f < pound_pos_2_r) { read_pos_start_num = pound_pos_2_f >> 5; read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_re = (pound_pos_2_f & 0X1f) << 1; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l2; lv_down_right = pound_pos_2_f; lv_down_left = s_r_o_r2; } else if(pound_pos_2_r <= s_r_o_l2 + 1) //5 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_2_r > 0) { read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_2[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_2[tid][0] ^ ref_seq_tmp2[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = pound_pos_2_r; lv_up_right = s_r_o_l2; lv_down_right = read_length_2; lv_down_left = s_r_o_r2; } else if((pound_pos_2_f <= s_r_o_l2 + 1) && (pound_pos_2_r >= s_r_o_r2)) //2 { #ifdef POUND_MIS for(bit_char_i = pound_pos_2_f, bit_char_i_ref = pound_pos_2_f + 32; (bit_char_i <= s_r_o_l2) && (bit_char_i_ref <= s_r_o_l2 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; for(bit_char_i = s_r_o_r2, bit_char_i_ref = s_r_o_r2 + 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_2_f <= s_r_o_l2) { read_pos_start_num = pound_pos_2_f >> 5; read_pos_end_num = s_r_o_l2 >> 5; read_pos_re = (pound_pos_2_f & 0X1f) << 1; read_pos_end_re = (s_r_o_l2 & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } if(s_r_o_r2 < pound_pos_2_r) { read_pos_start_num = s_r_o_r2 >> 5; read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_re = (s_r_o_r2 & 0X1f) << 1; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = pound_pos_2_f - 1; lv_down_right = read_length_2; lv_down_left = pound_pos_2_r; } else if((pound_pos_2_f > s_r_o_l2 + 1) && (pound_pos_2_f < s_r_o_r2)) //3 { #ifdef POUND_MIS for(bit_char_i = s_r_o_r2, bit_char_i_ref = s_r_o_r2 + 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_r2 < pound_pos_2_r) { read_pos_start_num = s_r_o_r2 >> 5; read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_re = (s_r_o_r2 & 0X1f) << 1; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l2; lv_down_right = read_length_2; lv_down_left = pound_pos_2_r; } else //4 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < s_r_o_l2) && (bit_char_i_ref < s_r_o_l2 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_l2 > 0) { read_pos_end_num = (s_r_o_l2 - 1) >> 5; read_pos_end_re = ((s_r_o_l2 - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_2[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_2[tid][0] ^ ref_seq_tmp2[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_2; #ifdef POUND_MODIFY lv_down_left = s_r_o_r2; #else lv_down_left = s_r_o_l2; #endif } #ifdef QUAL_FILT_LV #ifdef QUAL_FILT_LV_MIS for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l2 = computeEditDistance_mis(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt2, L[tid], qual_filt_lv_2_o + read_length_a2 - lv_up_right); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r2 = computeEditDistance_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt2, L[tid], qual_filt_lv_2 + lv_down_left); dm2 = dm_l2 + dm_r2 + pound_mis; dm_cir_2 = dm_l2 + dm_r2;// + pound_mis #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l2 = computeEditDistance_misboth(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt2, L[tid], L_mis[tid], qual_filt_lv_2_o + read_length_a2 - lv_up_right, &mis_n1); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r2 = computeEditDistance_misboth(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt2, L[tid], L_mis[tid], qual_filt_lv_2 + lv_down_left, &mis_n2); dm2 = mis_n1 + mis_n2 + pound_mis; dm_cir_2 = dm_l2 + dm_r2;// + pound_mis #endif ld2 = s_r_o_l2; rd2 = s_r_o_r2; #else #ifdef LAST_CIRCLE_NOPOUND pound_mis = 0; #endif for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l2 = computeEditDistance(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt2, L[tid]); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r2 = computeEditDistance(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt2, L[tid]); dm2 = dm_l2 + dm_r2 + pound_mis; dm_cir_2 = dm_l2 + dm_r2;// + pound_mis ld2 = s_r_o_l2; rd2 = s_r_o_r2; #endif #endif } } else { dm2 = mis_c_n; dm_cir_2 = mis_c_n; ld2 = 0; rd2 = 0; dm_l2 = 0; dm_r2 = 0; } //these two values could be different if((dm_l2 != -1) && (dm_r2 != -1)) { if(dm2 < dmt2) dmt2 = dm2 + 1; if(dm2 < lv_dmt2) lv_dmt2 = dm2 + 1; if(dm2 < max_mismatch2[tid] - 1) dmt2 = 0; } else { dm2 = MAX_EDIT_SCORE; dm_cir_2 = MAX_EDIT_SCORE; } nuc2_f = 1; } } else { pos_l = mat_pos2[tid][r_i] - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp2[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars_2); for(rst_i = 0; rst_i < ref_copy_num_2 - 1; rst_i++) { tran_tmp = (ref_seq_tmp2[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp2[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp2[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp2[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp2[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp2[tid][rst_i] &= low_mask_2; } else { memcpy(ref_seq_tmp2[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars_2); //clear the lowest n bit ref_seq_tmp2[tid][ref_copy_num_2 - 1] &= low_mask_2; } //trim the beginning and end of the current ref seq based on current minimum edit distance dm_t s_m_t = sub_mask2[tid][dmt2]; ref_seq_tmp2[tid][0] &= bit_tran[dmt2]; ref_seq_tmp2[tid][s_m_t] &= ex_d_mask2[tid][dmt2]; //traverse and check whether there is an existing seq that is as same as current new ref seq c_m_f = 0; for(q_rear_i = q_rear2 - 1; q_rear_i >= 0; q_rear_i--) { ref_tmp_ori = cache_end2[q_rear_i][0]; cache_end2[q_rear_i][0] &= bit_tran[dmt2]; ref_tmp_ori2 = cache_end2[q_rear_i][s_m_t]; cache_end2[q_rear_i][s_m_t] &= ex_d_mask2[tid][dmt2]; cmp_re = memcmp(cache_end2[q_rear_i], ref_seq_tmp2[tid], (s_m_t + 1) << 3); cache_end2[q_rear_i][0] = ref_tmp_ori; cache_end2[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm2 = cache_dis2[q_rear_i]; ld2 = cache_dml2[q_rear_i]; rd2 = cache_dmr2[q_rear_i]; dm_cir_2 = cache_dm_cir2[q_rear_i]; #ifdef KSW_ALN_PAIR if(local_ksw) { dm_l2 = cache_kl2[q_rear_i]; dm_r2 = cache_kr2[q_rear_i]; } #endif c_m_f = 1; break; } } if((q_n2 > MAX_Q_NUM) && (q_rear_i < 0)) { for(q_rear_i = MAX_Q_NUM - 1; q_rear_i >= q_rear2; q_rear_i--) { ref_tmp_ori = cache_end2[q_rear_i][0]; cache_end2[q_rear_i][0] &= bit_tran[dmt2]; ref_tmp_ori2 = cache_end2[q_rear_i][s_m_t]; cache_end2[q_rear_i][s_m_t] &= ex_d_mask2[tid][dmt2]; cmp_re = memcmp(cache_end2[q_rear_i], ref_seq_tmp2[tid], (s_m_t + 1) << 3); cache_end2[q_rear_i][0] = ref_tmp_ori; cache_end2[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm2 = cache_dis2[q_rear_i]; ld2 = cache_dml2[q_rear_i]; rd2 = cache_dmr2[q_rear_i]; dm_cir_2 = cache_dm_cir2[q_rear_i]; #ifdef KSW_ALN_PAIR if(local_ksw) { dm_l2 = cache_kl2[q_rear_i]; dm_r2 = cache_kr2[q_rear_i]; } #endif c_m_f = 1; break; } } } //do not find the seq in cache, exact match or lv and add into cache if(c_m_f == 0) { //exact match mis_c_n = 0; #ifdef QUAL_FILT mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp2[tid][ref_copy_num_2 - 2]; ref_seq_tmp2[tid][ref_copy_num_2 - 2] &= low_mask_2; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num_2 - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp2[tid][rst_i] ^ read_bit_2[tid][read_b_i]; #ifdef QUAL_FILT mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_2[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch2[tid]) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch2[tid]) break; #endif } ref_seq_tmp2[tid][ref_copy_num_2 - 2] = ref_tmp_ori; //lv if(mis_c_n_filt > max_mismatch2[tid]) { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR for(bit_char_i = s_r_o_l2, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l2, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(s_r_o_l2 + 1, read_char[tid], 33 + s_r_o_l2, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r2 - s_r_o_l2, &dm_l2, &tle, &gtle, &gscore, &max_off); for(bit_char_i = s_r_o_r2, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r2, read_b_i = 0; bit_char_i < read_length_2 + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(read_length_2 - s_r_o_r2, read_char[tid], 32 + read_length_2 - s_r_o_r2, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r2 - s_r_o_l2, &dm_r2, &tle, &gtle, &gscore, &max_off); dm2 = MAX_OP_SCORE_P2 - (dm_l2 + dm_r2); //read length cannot be more than 1024 ld2 = s_r_o_l2; rd2 = s_r_o_r2; #endif } else { #ifdef SPLIT_LV pound_mis = 0; if(pound_pos_2_f >= s_r_o_r2) //1 { #ifdef POUND_MIS for(bit_char_i = pound_pos_2_f, bit_char_i_ref = pound_pos_2_f + 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_2_f < pound_pos_2_r) { read_pos_start_num = pound_pos_2_f >> 5; read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_re = (pound_pos_2_f & 0X1f) << 1; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l2; lv_down_right = pound_pos_2_f; lv_down_left = s_r_o_r2; } else if(pound_pos_2_r <= s_r_o_l2 + 1) //5 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_2_r > 0) { read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_2[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_2[tid][0] ^ ref_seq_tmp2[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = pound_pos_2_r; lv_up_right = s_r_o_l2; lv_down_right = read_length_2; lv_down_left = s_r_o_r2; } else if((pound_pos_2_f <= s_r_o_l2 + 1) && (pound_pos_2_r >= s_r_o_r2)) //2 { #ifdef POUND_MIS for(bit_char_i = pound_pos_2_f, bit_char_i_ref = pound_pos_2_f + 32; (bit_char_i <= s_r_o_l2) && (bit_char_i_ref <= s_r_o_l2 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; for(bit_char_i = s_r_o_r2, bit_char_i_ref = s_r_o_r2 + 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_2_f <= s_r_o_l2) { read_pos_start_num = pound_pos_2_f >> 5; read_pos_end_num = s_r_o_l2 >> 5; read_pos_re = (pound_pos_2_f & 0X1f) << 1; read_pos_end_re = (s_r_o_l2 & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } if(s_r_o_r2 < pound_pos_2_r) { read_pos_start_num = s_r_o_r2 >> 5; read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_re = (s_r_o_r2 & 0X1f) << 1; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = pound_pos_2_f - 1; lv_down_right = read_length_2; lv_down_left = pound_pos_2_r; } else if((pound_pos_2_f > s_r_o_l2 + 1) && (pound_pos_2_f < s_r_o_r2)) //3 { #ifdef POUND_MIS for(bit_char_i = s_r_o_r2, bit_char_i_ref = s_r_o_r2 + 32; (bit_char_i < pound_pos_2_r) && (bit_char_i_ref < pound_pos_2_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_r2 < pound_pos_2_r) { read_pos_start_num = s_r_o_r2 >> 5; read_pos_end_num = (pound_pos_2_r - 1) >> 5; read_pos_re = (s_r_o_r2 & 0X1f) << 1; read_pos_end_re = ((pound_pos_2_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_2[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_2[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp2[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l2; lv_down_right = read_length_2; lv_down_left = pound_pos_2_r; } else //4 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < s_r_o_l2) && (bit_char_i_ref < s_r_o_l2 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp2[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_l2 > 0) { read_pos_end_num = (s_r_o_l2 - 1) >> 5; read_pos_end_re = ((s_r_o_l2 - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_2[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_2[tid][0] ^ ref_seq_tmp2[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_2[tid][rst_i] ^ ref_seq_tmp2[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_2[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp2[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_2; #ifdef POUND_MODIFY lv_down_left = s_r_o_r2; #else lv_down_left = s_r_o_l2; #endif } #ifdef QUAL_FILT_LV #ifdef QUAL_FILT_LV_MIS for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #ifdef S_DEBUG printf("extension lv2 %u: %u %d %d\n", mat_rc[tid][r_i], lv_dmt2, lv_up_right, lv_up_left); #endif dm_l2 = computeEditDistance_mis(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt2, L[tid], qual_filt_lv_2_o + read_length_a2 - lv_up_right); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r2 = computeEditDistance_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt2, L[tid], qual_filt_lv_2 + lv_down_left); dm2 = dm_l2 + dm_r2 + pound_mis; dm_cir_2 = dm_l2 + dm_r2;// + pound_mis #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l2 = computeEditDistance_misboth(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt2, L[tid], L_mis[tid], qual_filt_lv_2_o + read_length_a2 - lv_up_right, &mis_n1); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r2 = computeEditDistance_misboth(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt2, L[tid], L_mis[tid], qual_filt_lv_2 + lv_down_left, &mis_n2); dm2 = mis_n1 + mis_n2 + pound_mis; dm_cir_2 = dm_l2 + dm_r2;// + pound_mis #endif ld2 = s_r_o_l2; rd2 = s_r_o_r2; #else #ifdef LAST_CIRCLE_NOPOUND pound_mis = 0; #endif for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l2 = computeEditDistance(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt2, L[tid]); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r2 = computeEditDistance(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt2, L[tid]); dm2 = dm_l2 + dm_r2 + pound_mis; dm_cir_2 = dm_l2 + dm_r2;// + pound_mis ld2 = s_r_o_l2; rd2 = s_r_o_r2; #endif #endif } } else { dm2 = mis_c_n; dm_cir_2 = mis_c_n; ld2 = 0; rd2 = 0; dm_l2 = 0; dm_r2 = 0; } //these two values could be different if((dm_l2 != -1) && (dm_r2 != -1)) { if(dm2 < dmt2) dmt2 = dm2 + 1; if(dm2 < lv_dmt2) lv_dmt2 = dm2 + 1; if(dm2 < max_mismatch2[tid] - 1) dmt2 = 0; } else { dm2 = MAX_EDIT_SCORE; dm_cir_2 = MAX_EDIT_SCORE; } //add the ref sequence at the end of queue memcpy(cache_end2[q_rear2], ref_seq_tmp2[tid], ref_copy_num_chars_2); cache_dis2[q_rear2] = dm2; //cache_lvf1[q_rear1] = lv_f1; cache_dml2[q_rear2] = ld2; cache_dmr2[q_rear2] = rd2; cache_dm_cir2[q_rear2] = dm_cir_2; #ifdef KSW_ALN_PAIR if(local_ksw) { cache_kl2[q_rear2] = dm_l2; cache_kr2[q_rear2] = dm_r2; } #endif q_rear2 = ((q_rear2 + 1) & 0X1f); ++q_n2; //add edit distance } } #endif dm_cir = dm_cir_1 + dm_cir_2; if(dm_cir < dm_cir_min) dm_cir_min = dm_cir; dm12 = dm1 + dm2; if(dm12 < dm_op[tid]) { #ifdef DM_COPY_PAIR for(dm_i = 0; dm_i < v_cnt; dm_i++) { ops_vector_pos1[tid][dm_i] = op_vector_pos1[tid][dm_i]; ops_dm_l1[tid][dm_i] = op_dm_l1[tid][dm_i]; ops_dm_r1[tid][dm_i] = op_dm_r1[tid][dm_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars1); #else if(!((op_dm_l1[tid][dm_i] == 0) && (op_dm_r1[tid][dm_i] == 0))) memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars1); #endif ops_dm_ex1[tid][dm_i] = op_dm_ex1[tid][dm_i]; ops_vector_pos2[tid][dm_i] = op_vector_pos2[tid][dm_i]; ops_dm_l2[tid][dm_i] = op_dm_l2[tid][dm_i]; ops_dm_r2[tid][dm_i] = op_dm_r2[tid][dm_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq2[tid][dm_i], op_vector_seq2[tid][dm_i], ref_copy_num_chars2); #else if(!((op_dm_l2[tid][dm_i] == 0) && (op_dm_r2[tid][dm_i] == 0))) memcpy(ops_vector_seq2[tid][dm_i], op_vector_seq2[tid][dm_i], ref_copy_num_chars2); #endif ops_dm_ex2[tid][dm_i] = op_dm_ex2[tid][dm_i]; #ifdef KSW_ALN_PAIR if(local_ksw) { ops_dm_kl1[tid][dm_i] = op_dm_kl1[tid][dm_i]; ops_dm_kr1[tid][dm_i] = op_dm_kr1[tid][dm_i]; ops_dm_kl2[tid][dm_i] = op_dm_kl2[tid][dm_i]; ops_dm_kr2[tid][dm_i] = op_dm_kr2[tid][dm_i]; } #endif ops_rc[tid][dm_i] = op_rc[tid][dm_i]; } vs_cnt = v_cnt; dm_ops[tid] = dm_op[tid]; #endif v_cnt = 0; if(mat_rc[tid][r_i] == 0) { op_vector_pos1[tid][v_cnt] = mat_pos1[tid][r_i]; op_vector_pos2[tid][v_cnt] = mat_pos2[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; op_dm_l2[tid][v_cnt] = ld2; op_dm_r2[tid][v_cnt] = rd2; op_dm_ex1[tid][v_cnt] = dm1; op_dm_ex2[tid][v_cnt] = dm2; #ifdef KSW_ALN_PAIR if(local_ksw) { op_dm_kl1[tid][v_cnt] = dm_l1; op_dm_kr1[tid][v_cnt] = dm_r1; op_dm_kl2[tid][v_cnt] = dm_l2; op_dm_kr2[tid][v_cnt] = dm_r2; } #endif } else { op_vector_pos1[tid][v_cnt] = mat_pos2[tid][r_i]; op_vector_pos2[tid][v_cnt] = mat_pos1[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld2; op_dm_r1[tid][v_cnt] = rd2; op_dm_l2[tid][v_cnt] = ld1; op_dm_r2[tid][v_cnt] = rd1; op_dm_ex1[tid][v_cnt] = dm2; op_dm_ex2[tid][v_cnt] = dm1; #ifdef KSW_ALN_PAIR if(local_ksw) { op_dm_kl1[tid][v_cnt] = dm_l2; op_dm_kr1[tid][v_cnt] = dm_r2; op_dm_kl2[tid][v_cnt] = dm_l1; op_dm_kr2[tid][v_cnt] = dm_r1; } #endif } #ifdef ALTER_DEBUG seed_length_arr[tid][v_cnt].seed_length = seed_length1 + seed_length2; seed_length_arr[tid][v_cnt].index = v_cnt; #endif op_rc[tid][v_cnt] = mat_rc[tid][r_i]; ++v_cnt; dm_op[tid] = dm12; } else if(dm12 == dm_op[tid]) { if(v_cnt < cus_max_output_ali) { if(mat_rc[tid][r_i] == 0) { op_vector_pos1[tid][v_cnt] = mat_pos1[tid][r_i]; op_vector_pos2[tid][v_cnt] = mat_pos2[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; op_dm_l2[tid][v_cnt] = ld2; op_dm_r2[tid][v_cnt] = rd2; op_dm_ex1[tid][v_cnt] = dm1; op_dm_ex2[tid][v_cnt] = dm2; #ifdef KSW_ALN_PAIR if(local_ksw) { op_dm_kl1[tid][v_cnt] = dm_l1; op_dm_kr1[tid][v_cnt] = dm_r1; op_dm_kl2[tid][v_cnt] = dm_l2; op_dm_kr2[tid][v_cnt] = dm_r2; } #endif } else { op_vector_pos1[tid][v_cnt] = mat_pos2[tid][r_i]; op_vector_pos2[tid][v_cnt] = mat_pos1[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld2; op_dm_r1[tid][v_cnt] = rd2; op_dm_l2[tid][v_cnt] = ld1; op_dm_r2[tid][v_cnt] = rd1; op_dm_ex1[tid][v_cnt] = dm2; op_dm_ex2[tid][v_cnt] = dm1; #ifdef KSW_ALN_PAIR if(local_ksw) { op_dm_kl1[tid][v_cnt] = dm_l2; op_dm_kr1[tid][v_cnt] = dm_r2; op_dm_kl2[tid][v_cnt] = dm_l1; op_dm_kr2[tid][v_cnt] = dm_r1; } #endif } #ifdef ALTER_DEBUG seed_length_arr[tid][v_cnt].seed_length = seed_length1 + seed_length2; seed_length_arr[tid][v_cnt].index = v_cnt; #endif op_rc[tid][v_cnt] = mat_rc[tid][r_i]; ++v_cnt; } } else if(dm12 < dm_ops[tid]) { vs_cnt = 0; if(mat_rc[tid][r_i] == 0) { ops_vector_pos1[tid][vs_cnt] = mat_pos1[tid][r_i]; ops_vector_pos2[tid][vs_cnt] = mat_pos2[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; ops_dm_l2[tid][vs_cnt] = ld2; ops_dm_r2[tid][vs_cnt] = rd2; ops_dm_ex1[tid][vs_cnt] = dm1; ops_dm_ex2[tid][vs_cnt] = dm2; #ifdef KSW_ALN_PAIR if(local_ksw) { ops_dm_kl1[tid][vs_cnt] = dm_l1; ops_dm_kr1[tid][vs_cnt] = dm_r1; ops_dm_kl2[tid][vs_cnt] = dm_l2; ops_dm_kr2[tid][vs_cnt] = dm_r2; } #endif } else { ops_vector_pos1[tid][vs_cnt] = mat_pos2[tid][r_i]; ops_vector_pos2[tid][vs_cnt] = mat_pos1[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld2; ops_dm_r1[tid][vs_cnt] = rd2; ops_dm_l2[tid][vs_cnt] = ld1; ops_dm_r2[tid][vs_cnt] = rd1; ops_dm_ex1[tid][vs_cnt] = dm2; ops_dm_ex2[tid][vs_cnt] = dm1; //for S #ifdef QUALS_CHECK ops_err[tid][vs_cnt] = error_f; #endif #ifdef KSW_ALN_PAIR if(local_ksw) { ops_dm_kl1[tid][vs_cnt] = dm_l2; ops_dm_kr1[tid][vs_cnt] = dm_r2; ops_dm_kl2[tid][vs_cnt] = dm_l1; ops_dm_kr2[tid][vs_cnt] = dm_r1; } #endif } ops_rc[tid][vs_cnt] = mat_rc[tid][r_i]; ++vs_cnt; dm_ops[tid] = dm12; } else if(dm12 == dm_ops[tid]) { if(vs_cnt < cus_max_output_ali) { if(mat_rc[tid][r_i] == 0) { ops_vector_pos1[tid][vs_cnt] = mat_pos1[tid][r_i]; ops_vector_pos2[tid][vs_cnt] = mat_pos2[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; ops_dm_l2[tid][vs_cnt] = ld2; ops_dm_r2[tid][vs_cnt] = rd2; ops_dm_ex1[tid][vs_cnt] = dm1; ops_dm_ex2[tid][vs_cnt] = dm2; #ifdef KSW_ALN_PAIR if(local_ksw) { ops_dm_kl1[tid][vs_cnt] = dm_l1; ops_dm_kr1[tid][vs_cnt] = dm_r1; ops_dm_kl2[tid][vs_cnt] = dm_l2; ops_dm_kr2[tid][vs_cnt] = dm_r2; } #endif } else { ops_vector_pos1[tid][vs_cnt] = mat_pos2[tid][r_i]; ops_vector_pos2[tid][vs_cnt] = mat_pos1[tid][r_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld2; ops_dm_r1[tid][vs_cnt] = rd2; ops_dm_l2[tid][vs_cnt] = ld1; ops_dm_r2[tid][vs_cnt] = rd1; ops_dm_ex1[tid][vs_cnt] = dm2; ops_dm_ex2[tid][vs_cnt] = dm1; #ifdef KSW_ALN_PAIR if(local_ksw) { ops_dm_kl1[tid][vs_cnt] = dm_l2; ops_dm_kr1[tid][vs_cnt] = dm_r2; ops_dm_kl2[tid][vs_cnt] = dm_l1; ops_dm_kr2[tid][vs_cnt] = dm_r1; } #endif } ops_rc[tid][vs_cnt] = mat_rc[tid][r_i]; ++vs_cnt; } } } if(local_ksw) { if((dm_cir_min > max_pair_score) && (cir_n != cir_fix_n)) { seed_l[tid] -= seed_step; cir_n = cir_fix_n; continue; } } else { if(dm_cir_min > max_pair_score) { seed_l[tid] -= seed_step; cir_n++; #ifdef CIR_JUMP if(last_circle_rate) { lv_k1 = (read_length1 * last_circle_rate); lv_k2 = (read_length2 * last_circle_rate); max_pair_score = (read_length1 + read_length2) * last_circle_rate; } #endif continue; } } #ifdef ALI_OUT seqio[seqi].v_cnt = v_cnt; if(v_cnt > 0) { #ifdef ALTER_DEBUG if(v_cnt > 1) qsort(seed_length_arr[tid], v_cnt, sizeof(seed_length_array), compare_seed_length); #endif de_m_p_o[tid] = 0; #ifdef PR_SINGLE pr_o_f[tid] = 0; #endif cnt.v_cnt = v_cnt; cnt.vs_cnt = vs_cnt; pair_sam_output(tid, read_length1, read_length2, f_cigarn, &cnt, seqi, lv_k1, lv_k2, pound_pos1_f_forward, pound_pos1_f_reverse, pound_pos1_r_forward, pound_pos1_r_reverse, pound_pos2_f_forward, pound_pos2_f_reverse, pound_pos2_r_forward, pound_pos2_r_reverse, cir_n); } #endif break; } cir_n++; } #ifdef PAIR_RANDOM #ifdef PR_COV_FILTER if((((pos_ren[0][0][tid] > 0) && (pos_ren[0][1][tid] > 0)) || ((pos_ren[1][0][tid] > 0) && (pos_ren[1][1][tid] > 0))) && (de_m_p_o[tid] == 1) && (cov_filt_f[tid] == 0)) #else if((((pos_ren[0][0][tid] > 0) && (pos_ren[0][1][tid] > 0)) || ((pos_ren[1][0][tid] > 0) && (pos_ren[1][1][tid] > 0))) && (de_m_p_o[tid] == 1)) #endif { #ifdef PR_SINGLE seed_re_r[tid] = 1; #endif #ifdef ALTER_DEBUG rep_go[tid] = 0; #endif seed_repetitive(tid, read_length1, read_length2, f_cigarn, ref_copy_num1, ref_copy_num2, ref_copy_num_chars1, ref_copy_num_chars2, &cnt, seqi, lv_k1, lv_k2, pound_pos1_f_forward, pound_pos1_f_reverse, pound_pos1_r_forward, pound_pos1_r_reverse, pound_pos2_f_forward, pound_pos2_f_reverse, pound_pos2_r_forward, pound_pos2_r_reverse); } #endif //deal with unmatched reads #ifdef UNMATCH_SINGLE_END if(de_m_p_o[tid] == 1) { #ifdef SINGLE_END_NOEXECUTE dm_op[tid] = MAX_OP_SCORE; dm_ops[tid] = MAX_OP_SCORE; v_cnt = 0; vs_cnt = 0; lv_k1 = (read_length1 * lv_rate_anchor) + 1;//lv_rate lv_k2 = (read_length2 * lv_rate_anchor) + 1;//lv_rate #ifdef SEED_FILTER_LENGTH max_sets_n[0][0] = (max_read_length[0][0] > max_read_length[1][1]) ? max_read_length[0][0]:max_read_length[1][1]; max_sets_n[0][1] = (max_read_length[0][1] > max_read_length[1][0]) ? max_read_length[0][1]:max_read_length[1][0]; max_sets_n[1][1] = max_sets_n[0][0]; max_sets_n[1][0] = max_sets_n[0][1]; #endif for(rc_i = 0; rc_i < 2; rc_i++) { for(un_ii = 0; un_ii < 2; un_ii++) { if(unmatch[rc_i][un_ii] == 1) continue; seed_pr1 = seed_pr[rc_i][un_ii]; #ifdef SEED_FILTER_LENGTH for(off_i = 0; off_i < spa_i[rc_i][un_ii]; off_i++) if(seed_pr1[off_i].length < max_sets_n[rc_i][un_ii] - length_reduce) { ++off_i; break; } spa_i[rc_i][un_ii] = off_i; #endif #ifdef SEED_FILTER_POS qsort(seed_pr1, spa_i[rc_i][un_ii], sizeof(seed_pa), compare_seed_filter_posn); seed_posn_filter = 0; #endif #ifdef SEED_FILTER single_lv_re = 0; #endif if(rc_i == 0) { if(un_ii == 0) { read_bit_1[tid] = read_bit1[tid][0]; #ifdef QUAL_FILT_SINGLE qual_filt_1 = qual_filt1[tid][0]; #endif #ifdef QUAL_FILT_LV_SINGLE qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif ref_copy_num_chars = ref_copy_num_chars1; ref_copy_num = ref_copy_num1; low_mask = low_mask1[tid]; sub_mask = sub_mask1[tid]; ex_d_mask = ex_d_mask1[tid]; max_mismatch = max_mismatch1_single[tid]; lv_k = lv_k1; read_length = read_length1; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; } else { read_bit_1[tid] = read_bit2[tid][1]; #ifdef QUAL_FILT_SINGLE qual_filt_1 = qual_filt2[tid][1]; #endif #ifdef QUAL_FILT_LV_SINGLE qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif ref_copy_num_chars = ref_copy_num_chars2; ref_copy_num = ref_copy_num2; low_mask = low_mask2[tid]; sub_mask = sub_mask2[tid]; ex_d_mask = ex_d_mask2[tid]; max_mismatch = max_mismatch2_single[tid]; lv_k = lv_k2; read_length = read_length2; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; } } else { if(un_ii == 0) { read_bit_1[tid] = read_bit2[tid][0]; #ifdef QUAL_FILT_SINGLE qual_filt_1 = qual_filt2[tid][0]; #endif #ifdef QUAL_FILT_LV_SINGLE qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif ref_copy_num_chars = ref_copy_num_chars2; ref_copy_num = ref_copy_num2; low_mask = low_mask2[tid]; sub_mask = sub_mask2[tid]; ex_d_mask = ex_d_mask2[tid]; max_mismatch = max_mismatch2_single[tid]; lv_k = lv_k2; read_length = read_length2; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; } else { read_bit_1[tid] = read_bit1[tid][1]; #ifdef QUAL_FILT_SINGLE qual_filt_1 = qual_filt1[tid][1]; #endif #ifdef QUAL_FILT_LV_SINGLE qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif ref_copy_num_chars = ref_copy_num_chars1; ref_copy_num = ref_copy_num1; low_mask = low_mask1[tid]; sub_mask = sub_mask1[tid]; ex_d_mask = ex_d_mask1[tid]; max_mismatch = max_mismatch1_single[tid]; lv_k = lv_k1; read_length = read_length1; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; } } for(seed1_i = 0; seed1_i < spa_i[rc_i][un_ii]; seed1_i++) { #ifdef SEED_FILTER if(seed_pr1[seed1_i].length > (read_length >> 1)) single_lv_re = 1; else { if(single_lv_re == 1) continue; } #endif if(seed_pr1[seed1_i].ui == 1) { end1_uc_f = 0; nuc1_f = 0; d_l1 = seed_pr1[seed1_i].ref_pos_off; d_r1 = seed_pr1[seed1_i].ref_pos_off_r; } else { end1_uc_f = 1; } q_rear1 = 0; q_n1 = 0; dmt1 = ali_exl; lv_dmt1 = lv_k; s_r_o_l1 = seed_pr1[seed1_i].s_r_o_l; s_r_o_r1 = seed_pr1[seed1_i].s_r_o_r; #ifdef ALTER_DEBUG_ANCHOR seed_length1 = seed_pr1[seed1_i].length; #endif for(psp_i = 0; psp_i < seed_pr1[seed1_i].pos_n; psp_i++) { #ifdef SEED_FILTER_POS if(seed_posn_filter > seed_filter_pos_num) break; seed_posn_filter++; #endif posi = seed_set_pos[rc_i][un_ii][tid][seed_pr1[seed1_i].pos_start + psp_i]; #ifdef ANCHOR_LV_S s_offset_l = 0; s_offset_r = 0; #endif //for end1 if((end1_uc_f == 0) && ((dmt1 <= d_l1) && (dmt1 <= d_r1))) // && (nuc1_f == 0) { if(nuc1_f == 0) { pos_l = posi - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars); for(rst_i = 0; rst_i < ref_copy_num - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num - 1] &= low_mask; } //exact match mis_c_n = 0; #ifdef QUAL_FILT_SINGLE mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num - 2]; ref_seq_tmp1[tid][ref_copy_num - 2] &= low_mask; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT_SINGLE mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch) break; #endif } ref_seq_tmp1[tid][ref_copy_num - 2] = ref_tmp_ori; //dm = mis_c_n; //lv if(mis_c_n_filt > max_mismatch) { #ifdef SPLIT_LV pound_mis = 0; if(pound_pos_1_f >= s_r_o_r1) //1 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f < pound_pos_1_r) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r1; } else if(pound_pos_1_r <= s_r_o_l1 + 1) //5 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_r > 0) { read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = pound_pos_1_r; lv_up_right = s_r_o_l1; lv_down_right = read_length; lv_down_left = s_r_o_r1; } else if((pound_pos_1_f <= s_r_o_l1 + 1) && (pound_pos_1_r >= s_r_o_r1)) //2 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i <= s_r_o_l1) && (bit_char_i_ref <= s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f <= s_r_o_l1) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = s_r_o_l1 >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = (s_r_o_l1 & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length; lv_down_left = pound_pos_1_r; } else if((pound_pos_1_f > s_r_o_l1 + 1) && (pound_pos_1_f < s_r_o_r1)) //3 { #ifdef POUND_MIS for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = read_length; lv_down_left = pound_pos_1_r; } else //4 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < s_r_o_l1) && (bit_char_i_ref < s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_l1 > 0) { read_pos_end_num = (s_r_o_l1 - 1) >> 5; read_pos_end_re = ((s_r_o_l1 - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length; #ifdef POUND_MODIFY lv_down_left = s_r_o_r1; #else lv_down_left = s_r_o_l1; #endif } #ifdef QUAL_FILT_LV_SINGLE for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #ifdef ANCHOR_LV_S dm_l1 = computeEditDistance_mis_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length - 1 - lv_up_right, &s_offset_l); #else dm_l1 = computeEditDistance_mis(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length - 1 - lv_up_right); #endif for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #ifdef ANCHOR_LV_S dm_r1 = computeEditDistance_mis_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], qual_filt_lv_1 + lv_down_left, &s_offset_r); #else dm_r1 = computeEditDistance_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], qual_filt_lv_1 + lv_down_left); #endif dm1 = dm_l1 + dm_r1 + pound_mis; #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid]); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid]); dm1 = dm_l1 + dm_r1 + pound_mis; #endif ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { dm1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch - 1) dmt1 = 0; } else { #ifdef ANCHOR_LV_S if((s_offset_l + s_offset_r) < ((float )read_length * ANCHOR_LV_S_FLOAT)) dm1 = lv_dmt1 + pound_mis; else dm1 = MAX_EDIT_SCORE; #else dm1 = MAX_EDIT_SCORE; #endif } nuc1_f = 1; } } else { pos_l = posi - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars); for(rst_i = 0; rst_i < ref_copy_num - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num - 1] &= low_mask; } //trim the beginning and end of the current ref seq based on current minimum edit distance dm_t s_m_t = sub_mask[dmt1]; ref_seq_tmp1[tid][0] &= bit_tran[dmt1]; ref_seq_tmp1[tid][s_m_t] &= ex_d_mask[dmt1]; //traverse and check whether there is an existing seq that is as same as current new ref seq c_m_f = 0; for(q_rear_i = q_rear1 - 1; q_rear_i >= 0; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask[dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; c_m_f = 1; break; } } if((q_n1 > MAX_Q_NUM) && (q_rear_i < 0)) { for(q_rear_i = MAX_Q_NUM - 1; q_rear_i >= q_rear1; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask[dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; c_m_f = 1; break; } } } //do not find the seq in cache, exact match or lv and add into cache if(c_m_f == 0) { //exact match mis_c_n = 0; #ifdef QUAL_FILT_SINGLE mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num - 2]; ref_seq_tmp1[tid][ref_copy_num - 2] &= low_mask; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT_SINGLE mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch) break; #endif } ref_seq_tmp1[tid][ref_copy_num - 2] = ref_tmp_ori; //lv if(mis_c_n_filt > max_mismatch) { #ifdef SPLIT_LV pound_mis = 0; if(pound_pos_1_f >= s_r_o_r1) //1 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f < pound_pos_1_r) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r1; } else if(pound_pos_1_r <= s_r_o_l1 + 1) //5 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_r > 0) { read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = pound_pos_1_r; lv_up_right = s_r_o_l1; lv_down_right = read_length; lv_down_left = s_r_o_r1; } else if((pound_pos_1_f <= s_r_o_l1 + 1) && (pound_pos_1_r >= s_r_o_r1)) //2 { #ifdef POUND_MIS for(bit_char_i = pound_pos_1_f, bit_char_i_ref = pound_pos_1_f + 32; (bit_char_i <= s_r_o_l1) && (bit_char_i_ref <= s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(pound_pos_1_f <= s_r_o_l1) { read_pos_start_num = pound_pos_1_f >> 5; read_pos_end_num = s_r_o_l1 >> 5; read_pos_re = (pound_pos_1_f & 0X1f) << 1; read_pos_end_re = (s_r_o_l1 & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length; lv_down_left = pound_pos_1_r; } else if((pound_pos_1_f > s_r_o_l1 + 1) && (pound_pos_1_f < s_r_o_r1)) //3 { #ifdef POUND_MIS for(bit_char_i = s_r_o_r1, bit_char_i_ref = s_r_o_r1 + 32; (bit_char_i < pound_pos_1_r) && (bit_char_i_ref < pound_pos_1_r + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_r1 < pound_pos_1_r) { read_pos_start_num = s_r_o_r1 >> 5; read_pos_end_num = (pound_pos_1_r - 1) >> 5; read_pos_re = (s_r_o_r1 & 0X1f) << 1; read_pos_end_re = ((pound_pos_1_r - 1) & 0X1f) << 1; if(read_pos_start_num == read_pos_end_num) { xor_tmp = ((read_bit_1[tid][read_pos_start_num] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)) ^ ((ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re) >> (62 - read_pos_end_re + read_pos_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = (read_bit_1[tid][read_pos_start_num] << read_pos_re) ^ (ref_seq_tmp1[tid][read_pos_start_num + 1] << read_pos_re); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = read_pos_start_num + 1, rst_i_1 = read_pos_start_num + 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = s_r_o_l1; lv_down_right = read_length; lv_down_left = pound_pos_1_r; } else //4 { #ifdef POUND_MIS for(bit_char_i = 0, bit_char_i_ref = 32; (bit_char_i < s_r_o_l1) && (bit_char_i_ref < s_r_o_l1 + 32); bit_char_i++, bit_char_i_ref++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ref_seq_tmp1[tid][bit_char_i_ref >> 5] >> ((31 - (bit_char_i_ref & 0X1f)) << 1)) & 0X3)) pound_mis++; #else if(s_r_o_l1 > 0) { read_pos_end_num = (s_r_o_l1 - 1) >> 5; read_pos_end_re = ((s_r_o_l1 - 1) & 0X1f) << 1; if(read_pos_end_num == 0) { xor_tmp = (read_bit_1[tid][0] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } else { xor_tmp = read_bit_1[tid][0] ^ ref_seq_tmp1[tid][1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); for(rst_i = 1, rst_i_1 = 2; rst_i < read_pos_end_num; rst_i++, rst_i_1++) { xor_tmp = read_bit_1[tid][rst_i] ^ ref_seq_tmp1[tid][rst_i_1]; pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } xor_tmp = (read_bit_1[tid][read_pos_end_num] >> (62 - read_pos_end_re)) ^ (ref_seq_tmp1[tid][read_pos_end_num + 1] >> (62 - read_pos_end_re)); pound_mis += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); } } #endif lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length; #ifdef POUND_MODIFY lv_down_left = s_r_o_r1; #else lv_down_left = s_r_o_l1; #endif } #ifdef QUAL_FILT_LV_SINGLE for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #ifdef ANCHOR_LV_S dm_l1 = computeEditDistance_mis_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length - 1 - lv_up_right, &s_offset_l); #else dm_l1 = computeEditDistance_mis(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length - 1 - lv_up_right); #endif for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #ifdef ANCHOR_LV_S dm_r1 = computeEditDistance_mis_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], qual_filt_lv_1 + lv_down_left, &s_offset_r); #else dm_r1 = computeEditDistance_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid], qual_filt_lv_1 + lv_down_left); #endif dm1 = dm_l1 + dm_r1 + pound_mis; #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_dmt1, L[tid]); for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_dmt1, L[tid]); dm1 = dm_l1 + dm_r1 + pound_mis; #endif ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { dm1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch - 1) dmt1 = 0; } else { #ifdef ANCHOR_LV_S if((s_offset_l + s_offset_r) < ((float )read_length * ANCHOR_LV_S_FLOAT)) dm1 = lv_dmt1 + pound_mis; else dm1 = MAX_EDIT_SCORE; #else dm1 = MAX_EDIT_SCORE; #endif } //add the ref sequence at the end of queue memcpy(cache_end1[q_rear1], ref_seq_tmp1[tid], ref_copy_num_chars); cache_dis1[q_rear1] = dm1; cache_dml1[q_rear1] = ld1; cache_dmr1[q_rear1] = rd1; q_rear1 = ((q_rear1 + 1) & 0X1f); ++q_n1; //add edit distance } } /* x = posi; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } posi = x - chr_end_n[chr_re - 1] + 1; fprintf(stderr, "to add: %u %u %d %d %d rc: %u\n", chr_re, posi, dm1, dm_op[tid], dm_ops[tid],((rc_i << 1) + un_ii)); posi = x; */ if(dm1 < dm_op[tid]) { #ifdef DM_COPY_SINGLE for(dm_i = 0; dm_i < v_cnt; dm_i++) { ops_vector_pos1[tid][dm_i] = op_vector_pos1[tid][dm_i]; ops_dm_l1[tid][dm_i] = op_dm_l1[tid][dm_i]; ops_dm_r1[tid][dm_i] = op_dm_r1[tid][dm_i]; if(!((op_dm_l1[tid][dm_i] == 0) && (op_dm_r1[tid][dm_i] == 0))) memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars); ops_rc[tid][dm_i] = op_rc[tid][dm_i]; } vs_cnt = v_cnt; dm_ops[tid] = dm_op[tid]; #endif v_cnt = 0; op_vector_pos1[tid][v_cnt] = posi; if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; #ifdef ALTER_DEBUG_ANCHOR seed_length_arr[tid][v_cnt].seed_length = seed_length1; seed_length_arr[tid][v_cnt].index = v_cnt; #endif op_rc[tid][v_cnt] = ((rc_i << 1) + un_ii); ++v_cnt; dm_op[tid] = dm1; } else if(dm1 == dm_op[tid]) { if(v_cnt < cus_max_output_ali) { op_vector_pos1[tid][v_cnt] = posi; if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; #ifdef ALTER_DEBUG_ANCHOR seed_length_arr[tid][v_cnt].seed_length = seed_length1; seed_length_arr[tid][v_cnt].index = v_cnt; #endif op_rc[tid][v_cnt] = ((rc_i << 1) + un_ii); ++v_cnt; } } else if(dm1 < dm_ops[tid]) { vs_cnt = 0; ops_vector_pos1[tid][vs_cnt] = posi; if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; ops_rc[tid][vs_cnt] = ((rc_i << 1) + un_ii); ++vs_cnt; dm_ops[tid] = dm1; } else if(dm1 == dm_ops[tid]) { if(vs_cnt < cus_max_output_ali) { ops_vector_pos1[tid][vs_cnt] = posi; if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; ops_rc[tid][vs_cnt] = ((rc_i << 1) + un_ii); ++vs_cnt; } } } } } } #ifdef PR_SINGLE if(seed_re_r[tid] == 1) { if(min_mis[tid] <= dm_op[tid]) { if(min_mis[tid] < dm_op[tid]) { dm_op[tid] = min_mis[tid]; v_cnt = 0; } for(rc_i = 0; rc_i < 2; rc_i++) for(rc_ii = 0; rc_ii < 2; rc_ii++) for(v_cnt_i = 0; v_cnt_i < seedpos_misn[rc_i][rc_ii][tid]; v_cnt_i++) { if(seedpos_mis[rc_i][rc_ii][tid][v_cnt_i] == min_mis[tid]) { if(v_cnt < cus_max_output_ali) { op_vector_pos1[tid][v_cnt] = seedpos[rc_i][rc_ii][tid][v_cnt_i]; op_dm_l1[tid][v_cnt] = 0; op_dm_r1[tid][v_cnt] = 0; op_rc[tid][v_cnt] = ((rc_i << 1) + rc_ii); #ifdef ALTER_DEBUG_ANCHOR seed_length_arr[tid][v_cnt].seed_length = 0; seed_length_arr[tid][v_cnt].index = v_cnt; #endif ++v_cnt; } } } } else if(min_mis[tid] <= dm_ops[tid]) { if(min_mis[tid] < dm_ops[tid]) { dm_ops[tid] = min_mis[tid]; vs_cnt = 0; } for(rc_i = 0; rc_i < 2; rc_i++) for(rc_ii = 0; rc_ii < 2; rc_ii++) for(v_cnt_i = 0; v_cnt_i < seedpos_misn[rc_i][rc_ii][tid]; v_cnt_i++) { if(seedpos_mis[rc_i][rc_ii][tid][v_cnt_i] == min_mis[tid]) { if(vs_cnt < cus_max_output_ali) { ops_vector_pos1[tid][vs_cnt] = seedpos[rc_i][rc_ii][tid][v_cnt_i]; ops_dm_l1[tid][vs_cnt] = 0; ops_dm_r1[tid][vs_cnt] = 0; ops_rc[tid][vs_cnt] = ((rc_i << 1) + rc_ii); ++vs_cnt; } } } } } #endif if(v_cnt > 0) { #ifdef ALTER_DEBUG_ANCHOR if(v_cnt > 1) qsort(seed_length_arr[tid], v_cnt, sizeof(seed_length_array), compare_seed_length); #endif #ifdef REDUCE_ANCHOR tra1_i = 0; tra2_i = 0; anchor_n1 = 0; anchor_n2 = 0; memset(op_mask, 0, v_cnt << 1); memset(ops_mask, 0, vs_cnt << 1); for(va_cnt_i = 0; va_cnt_i < v_cnt; va_cnt_i++) { #ifdef ALTER_DEBUG_ANCHOR if(v_cnt > 1) tra_i = seed_length_arr[tid][va_cnt_i].index; else tra_i = va_cnt_i; #else tra_i = va_cnt_i; #endif if((op_rc[tid][tra_i] == 0) || (op_rc[tid][tra_i] == 3)) { poses1[tid][anchor_n1] = op_vector_pos1[tid][tra_i]; ls1[tid][anchor_n1] = op_dm_l1[tid][tra_i]; rs1[tid][anchor_n1] = op_dm_r1[tid][tra_i]; rcs1[tid][anchor_n1] = op_rc[tid][tra_i]; dms1[tid][anchor_n1] = dm_op[tid]; orders1[tid][anchor_n1] = tra_i; anchor_n1++; } else { poses2[tid][anchor_n2] = op_vector_pos1[tid][tra_i]; ls2[tid][anchor_n2] = op_dm_l1[tid][tra_i]; rs2[tid][anchor_n2] = op_dm_r1[tid][tra_i]; rcs2[tid][anchor_n2] = op_rc[tid][tra_i]; dms2[tid][anchor_n2] = dm_op[tid]; orders2[tid][anchor_n2] = tra_i; anchor_n2++; } } for(tra_i = 0; tra_i < vs_cnt; tra_i++) { if((ops_rc[tid][tra_i] == 0) || (ops_rc[tid][tra_i] == 3)) { poses1[tid][anchor_n1] = ops_vector_pos1[tid][tra_i]; ls1[tid][anchor_n1] = ops_dm_l1[tid][tra_i]; rs1[tid][anchor_n1] = ops_dm_r1[tid][tra_i]; rcs1[tid][anchor_n1] = ops_rc[tid][tra_i]; dms1[tid][anchor_n1] = dm_ops[tid]; orders1[tid][anchor_n1] = tra_i + MAX_REDUCE_ANCHOR_NUM; anchor_n1++; } else { poses2[tid][anchor_n2] = ops_vector_pos1[tid][tra_i]; ls2[tid][anchor_n2] = ops_dm_l1[tid][tra_i]; rs2[tid][anchor_n2] = ops_dm_r1[tid][tra_i]; rcs2[tid][anchor_n2] = ops_rc[tid][tra_i]; dms2[tid][anchor_n2] = dm_ops[tid]; orders2[tid][anchor_n2] = tra_i + MAX_REDUCE_ANCHOR_NUM; anchor_n2++; } } #endif #ifdef ANCHOR_HASH_ALI for(anchor_hash_i = 0; anchor_hash_i < 4; anchor_hash_i++) { if(anchor_hash_i == 0) { read_length = read_length2; ori = read_bit2[tid][1]; } else if(anchor_hash_i == 1) { read_length = read_length1; ori = read_bit1[tid][0]; } else if(anchor_hash_i == 2) { read_length = read_length1; ori = read_bit1[tid][1]; } else { read_length = read_length2; ori = read_bit2[tid][0]; } des_i = 0; for(ori_i = 0; ori_i < read_length >> 5; ori_i++) { for(char_i = 0; (char_i <= 64 - k_anchor_b) && (des_i <= read_length - k_anchor); char_i += 2, des_i++) { rh[tid][des_i].des = ((ori[ori_i] >> (64 - char_i - k_anchor_b)) & anchor_mask); rh[tid][des_i].off_set = des_i; } //note that boundary value for(char_i = 2; (char_i < k_anchor_b) && (des_i <= read_length - k_anchor); char_i += 2, des_i++) { rh[tid][des_i].des = ((ori[ori_i] & anchor_mask_boundary_re[char_i >> 1]) << char_i) | (ori[ori_i + 1] >> (64 - char_i));// & anchor_mask_boundary[char_i >> 1] rh[tid][des_i].off_set = des_i; } } qsort(rh[tid], des_i, sizeof(read_h), compare_read_hash); memset(anchor_hash[tid][anchor_hash_i], 0, 1 << 17); read_k_p = rh[tid][0].des; anchor_hash[tid][anchor_hash_i][read_k_p >> k_anchor_back] = 0; anchor_array[tid][anchor_hash_i][0] = (read_k_p & anchor_back_mask); anchor_point[tid][anchor_hash_i][0] = 0; anchor_pos[tid][anchor_hash_i][0] = rh[tid][0].off_set; array_i = 1; array_i_p = 0; for(char_i = 1; char_i < des_i; char_i++) { anchor_pos[tid][anchor_hash_i][char_i] = rh[tid][char_i].off_set; read_k_t = rh[tid][char_i].des; if((read_k_t >> k_anchor_back) == (read_k_p >> k_anchor_back)) { if((read_k_t & anchor_back_mask) != (read_k_p & anchor_back_mask)) { anchor_array[tid][anchor_hash_i][array_i] = (read_k_t & anchor_back_mask); anchor_point[tid][anchor_hash_i][array_i] = char_i; array_i++; } } else { anchor_hash[tid][anchor_hash_i][read_k_t >> k_anchor_back] = (array_i << 5); anchor_hash[tid][anchor_hash_i][read_k_p >> k_anchor_back] |= (array_i - array_i_p); array_i_p = array_i; anchor_array[tid][anchor_hash_i][array_i] = (read_k_t & anchor_back_mask); anchor_point[tid][anchor_hash_i][array_i] = char_i; array_i++; } read_k_p = read_k_t; } anchor_hash[tid][anchor_hash_i][read_k_p >> k_anchor_back] |= (array_i - array_i_p); anchor_point[tid][anchor_hash_i][array_i] = char_i; } #endif v_cnt_i = 0; #ifdef ALTER_DEBUG_ANCHOR if(v_cnt > 1) v_cnt_i = seed_length_arr[tid][v_cnt_i].index; #endif #ifdef REDUCE_ANCHOR op_mask[v_cnt_i] = 1; #endif x = op_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re1 = mid; break; } chr_re1 = low; } sam_pos1 = op_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re1 - 1] + 1; #ifdef FIX_SA op_rc_tmp = op_rc[tid][v_cnt_i]; #endif if(op_rc[tid][v_cnt_i] == 0) { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif ksw_s = x + end_dis1[tid] - devi; ksw_e = x + insert_dis + devi; cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else if(op_rc[tid][v_cnt_i] == 1) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif ksw_s = x - (end_dis1[tid] + devi); ksw_e = x - (end_dis1[tid] - devi) + read_length1; cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else if(op_rc[tid][v_cnt_i] == 2) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif ksw_s = x + (end_dis2[tid] - devi); ksw_e = x + insert_dis + devi; cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } else { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif ksw_s = x - (end_dis2[tid] + devi); ksw_e = x - (end_dis2[tid] - devi) + read_length2; cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } #ifdef ANCHOR_HASH_ALI anchor_hash_p = anchor_hash[tid][op_rc[tid][v_cnt_i]]; anchor_array_p = anchor_array[tid][op_rc[tid][v_cnt_i]]; anchor_point_p = anchor_point[tid][op_rc[tid][v_cnt_i]]; anchor_pos_p = anchor_pos[tid][op_rc[tid][v_cnt_i]]; #endif d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = op_dm_l1[tid][v_cnt_i]; s_r_o_r = op_dm_r1[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m_1); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length_1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length_1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length_1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p1 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length_1) { sn = sprintf(cigar_p1 + snt, "%uS", read_length_1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p1[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p1[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_1 != cigar_len) { if(read_length_1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_1); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m_1); } else { cigar_len_re = cigar_len_tmp + (read_length_1 - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos1 = sam_pos1 + i_n1 - d_n1 + s_offset1; //use ksw to find the other end alignment ksw_re = 0; #ifdef REDUCE_ANCHOR other_end_flag = 0; #endif #ifdef ANCHOR_HASH_ALI buffer_i = 0; r_b_v = 0; for(base_i = ksw_s - 1; base_i < ksw_e - k_anchor; base_i += anchor_seed_d) { if(base_i + k_anchor - 1 < r_b_v) continue; base_re = (base_i & 0X1f); if(base_re <= k_anchor_re) { anchor_ref = ((buffer_ref_seq[base_i >> 5] >> ((k_anchor_re - base_re) << 1)) & anchor_mask); } else { anchor_ref = (((buffer_ref_seq[base_i >> 5] & anchor_mask_boundary[32 - base_re]) << ((base_re - k_anchor_re) << 1)) | (buffer_ref_seq[(base_i >> 5) + 1] >> ((32 + k_anchor_re - base_re) << 1))); } max_right = 0; for(tra_i = 0; tra_i < (anchor_hash_p[anchor_ref >> 4] & 0X1f); tra_i++) { array_index = (anchor_hash_p[anchor_ref >> 4] >> 5) + tra_i; if(anchor_array_p[array_index] == (anchor_ref & 0Xf)) { max_seed_length = 0; for(print_i = anchor_point_p[array_index]; print_i < anchor_point_p[array_index + 1]; print_i++) { //extension on both sides for(left_i = anchor_pos_p[print_i] - 1, base_i_off_l = base_i - 1; (left_i >= 0) && (base_i_off_l >= ksw_s - 1); left_i--, base_i_off_l--) { #ifdef CHAR_CP if(((read_bit_2[tid][left_i >> 5] >> ((31 - (left_i & 0X1f)) << 1)) & 0X3) != ((buffer_ref_seq[base_i_off_l >> 5] >> ((31 - (base_i_off_l & 0X1f)) << 1)) & 0X3)) break; #else if(sam_seq2[left_i] != Dna5Tochar[((buffer_ref_seq[base_i_off_l >> 5] >> ((31 - (base_i_off_l & 0X1f)) << 1)) & 0X3)]) break; #endif } for(right_i = anchor_pos_p[print_i] + k_anchor, base_i_off_r = base_i + k_anchor; (right_i < read_length_2) && (base_i_off_r < ksw_e); right_i++, base_i_off_r++) { #ifdef CHAR_CP if(((read_bit_2[tid][right_i >> 5] >> ((31 - (right_i & 0X1f)) << 1)) & 0X3) != ((buffer_ref_seq[base_i_off_r >> 5] >> ((31 - (base_i_off_r & 0X1f)) << 1)) & 0X3)) break; #else if(sam_seq2[right_i] != Dna5Tochar[((buffer_ref_seq[base_i_off_r >> 5] >> ((31 - (base_i_off_r & 0X1f)) << 1)) & 0X3)]) break; #endif } seed_length = right_i - left_i - 1; if(seed_length > max_seed_length) { max_seed_length = seed_length; max_right = base_i_off_r; } anchor_seed_buffer[tid][buffer_i].read_left_off = left_i; anchor_seed_buffer[tid][buffer_i].read_right_off = right_i; anchor_seed_buffer[tid][buffer_i].ref_left_off = base_i_off_l; anchor_seed_buffer[tid][buffer_i].ref_right_off = base_i_off_r; anchor_seed_buffer[tid][buffer_i].seed_length = seed_length; buffer_i++; } break; } } r_b_v = max_right; } if((buffer_i > 0) && (max_seed_length > anchor_seed_length_thr)) { qsort(anchor_seed_buffer[tid], buffer_i, sizeof(anchor_seed), comepare_anchor_seed); //LV left_i = anchor_seed_buffer[tid][0].read_left_off; right_i = anchor_seed_buffer[tid][0].read_right_off; base_i_off_l = anchor_seed_buffer[tid][0].ref_left_off; base_i_off_r = anchor_seed_buffer[tid][0].ref_right_off; d_n1 = 0; i_n1 = 0; if((left_i == -1) && (right_i == read_length_2)) { strcpy(cigar_p2, cigar_m_2); } else //indel { #ifdef LV_CCIGAR #ifdef CHAR_CP for(bit_char_i = left_i, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); //33 for(bit_char_i = base_i_off_l, read_b_i = 0; bit_char_i > base_i_off_l - left_i - 33; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = left_i, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; //33 for(bit_char_i = base_i_off_l, read_b_i = 0; bit_char_i > base_i_off_l - left_i - 33; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif dm_l2 = computeEditDistanceWithCigar_s_nm_left(ali_ref_seq[tid], left_i + 33, read_char[tid], left_i + 1, lv_k_2, cigarBuf1, f_cigarn, L[tid], &nm_score1, &s_offset2);//, 0 #ifdef CHAR_CP for(bit_char_i = right_i, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = base_i_off_r, read_b_i = 0; bit_char_i < base_i_off_r + read_length_2 - right_i + 32; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = right_i, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for(bit_char_i = base_i_off_r, read_b_i = 0; bit_char_i < base_i_off_r + read_length_2 - right_i + 32; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif dm_r2 = computeEditDistanceWithCigar_s_nm(ali_ref_seq[tid], read_length_2 - right_i + 32, read_char[tid], read_length_2 - right_i, lv_k_2, cigarBuf2, f_cigarn, L[tid], &nm_score2);//, 0 #endif //deal with cigar of LV //deal with front and back lv cigar m_m_n = anchor_seed_buffer[tid][0].seed_length; strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok (cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; if((left_i != -1) && (right_i != read_length_2)) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if(left_i == -1) { if(b_cigar[pchl] == 'M') sn = sprintf(cigar_p2, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); else sn = sprintf(cigar_p2, "%uM%s", m_m_n, b_cigar); snt += sn; } else { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } #ifdef CIGAR_LEN_ERR #ifdef FIX_SA sv_s_len_p = 0; #endif cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; #ifdef FIX_SA if(cigar_p2[s_o_tmp - 1] == 'S') sv_s_len_p += cigar_len_tmp; #endif if(cigar_p2[s_o_tmp - 1] == 'I') dm_l2 += cigar_len_tmp; }else{ cigar_len_tmp = atoi(pch_tmp); dm_l2 += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_2 != cigar_len) { if(read_length_2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m_2); } else { cigar_len_re = cigar_len_tmp + (read_length_2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset2 = 0; #endif sam_pos2 = base_i_off_l - left_i + i_n1 - d_n1 - chr_end_n[chr_re1 - 1] + 2 + s_offset2; chr_re2 = chr_re1; ksw_re = 1; } else { #ifdef REDUCE_ANCHOR if((op_rc[tid][v_cnt_i] == 0) || (op_rc[tid][v_cnt_i] == 3)) { other_end_flag = 0; while(tra2_i < anchor_n2) { rcs = rcs2[tid][tra2_i]; rs = rs2[tid][tra2_i]; ls = ls2[tid][tra2_i]; sam_pos2 = poses2[tid][tra2_i]; dm_l2 = dms2[tid][tra2_i]; dm_r2 = 0; if(orders2[tid][tra2_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders2[tid][tra2_i] - MAX_REDUCE_ANCHOR_NUM; if(ops_mask[v_cnt_i_tmp] == 0) { op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; ops_mask[v_cnt_i_tmp] = 1; other_end_flag = 1; tra2_i++; break; } } else { v_cnt_i_tmp = orders2[tid][tra2_i]; if(op_mask[v_cnt_i_tmp] == 0) { op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; op_mask[v_cnt_i_tmp] = 1; other_end_flag = 1; tra2_i++; break; } } tra2_i++; } } else { other_end_flag = 0; while(tra1_i < anchor_n1) { rcs = rcs1[tid][tra1_i]; rs = rs1[tid][tra1_i]; ls = ls1[tid][tra1_i]; sam_pos2 = poses1[tid][tra1_i]; dm_l2 = dms1[tid][tra1_i]; dm_r2 = 0; if(orders1[tid][tra1_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders1[tid][tra1_i] - MAX_REDUCE_ANCHOR_NUM; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; if(ops_mask[v_cnt_i_tmp] == 1) { ops_mask[v_cnt_i_tmp] = 1; tra1_i++; other_end_flag = 1; break; } } else { v_cnt_i_tmp = orders1[tid][tra1_i]; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; if(op_mask[v_cnt_i_tmp] == 1) { op_mask[v_cnt_i_tmp] = 1; tra1_i++; other_end_flag = 1; break; } } tra1_i++; } } if(other_end_flag) { x = sam_pos2; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re2 = mid; break; } chr_re2 = low; } sam_pos2 = x - chr_end_n[chr_re2 - 1] + 1; if(rcs == 0) { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); /* for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else if(rcs == 1) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else if(rcs == 2) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); /* for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } else { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = ls; s_r_o_r = rs; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m_2); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length_1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length_1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length_1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length_1) { sn = sprintf(cigar_p2 + snt, "%uS", read_length_1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p2[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR #ifdef FIX_SA sv_s_len_p = 0; #endif cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; #ifdef FIX_SA if(cigar_p2[s_o_tmp - 1] == 'S') sv_s_len_p += cigar_len_tmp; #endif } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_1 != cigar_len) { if(read_length_1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_1); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m_1); } else { cigar_len_re = cigar_len_tmp + (read_length_1 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos2 = sam_pos2 + i_n1 - d_n1 + s_offset1; ksw_re = 1; } else { sam_pos2 = sam_pos1; #ifdef PICARD_BUG strcpy(cigar_p2, cigar_p1); #else strcpy(cigar_p2, "*"); #endif chr_re2 = chr_re1; ksw_re = 0; } #else sam_pos2 = sam_pos1; #ifdef PICARD_BUG strcpy(cigar_p2, cigar_p1); #else strcpy(cigar_p2, "*"); #endif chr_re2 = chr_re1; ksw_re = 0; #endif } #endif if(op_rc[tid][v_cnt_i] == 0) { #ifdef FIX_SV sv_add = 2; #endif #ifdef CHAR_CP strcpy(sam_seq1, seqio[seqi].read_seq1); #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 2) strcpy(sam_seq2, seqio[seqi].read_seq2); else { for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); } //if((rcs == 0) || (rcs == 3)) printf("Error: %u\n", rcs); } else { for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); } #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #endif seq1p = sam_seq1; if(ksw_re == 1) { sam_cross = sam_pos2 + read_length2 - sam_pos1; if((sam_cross > insert_dis + devi) || (sam_cross < insert_dis - devi) || (chr_re1 != chr_re2)) { if((other_end_flag) && (rcs == 2)) { sam_flag1 = 65; sam_flag2 = 129; } else { sam_flag1 = 97; sam_flag2 = 145; } } else { if((other_end_flag) && (rcs == 2)) { sam_flag1 = 67; sam_flag2 = 131; } else { sam_flag1 = 99; sam_flag2 = 147; } } seq2p = sam_seq2; } else { sam_flag1 = 73; sam_flag2 = 133; sam_cross = 0; seq2p = seqio[seqi].read_seq2; qual_flag = 2; #ifdef SAMTOOLS_BUG sam_pos2 = 0; chr_re2 = chr_file_n; #endif } cp1 = cigar_p1; cp2 = cigar_p2; seqio[seqi].nm1 = dm_op[tid]; seqio[seqi].nm2 = dm_l2 + dm_r2; } else if(op_rc[tid][v_cnt_i] == 1) { #ifdef FIX_SV sv_add = 1; #endif #ifdef CHAR_CP for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 0) strcpy(sam_seq2, seqio[seqi].read_seq1); else { for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); } //if((rcs == 1) || (rcs == 2)) printf("Error: %u\n", rcs); } else { strcpy(sam_seq2, seqio[seqi].read_seq1); } #else strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #endif seq2p = sam_seq1; if(ksw_re == 1) { chr_re1 = chr_re1 ^ chr_re2; chr_re2 = chr_re1 ^ chr_re2; chr_re1 = chr_re1 ^ chr_re2; sam_pos1 = sam_pos1 ^ sam_pos2; sam_pos2 = sam_pos1 ^ sam_pos2; sam_pos1 = sam_pos1 ^ sam_pos2; sam_cross = sam_pos2 + read_length2 - sam_pos1; if((sam_cross > insert_dis + devi) || (sam_cross < insert_dis - devi) || (chr_re1 != chr_re2)) { if((other_end_flag) && (rcs != 0)) { sam_flag1 = 113; sam_flag2 = 177; } else { sam_flag1 = 97; sam_flag2 = 145; } } else { if((other_end_flag) && (rcs != 0)) { sam_flag1 = 115; sam_flag2 = 179; } else { sam_flag1 = 99; sam_flag2 = 147; } } seq1p = sam_seq2; } else { sam_flag1 = 117; sam_flag2 = 153; sam_cross = 0; seq1p = seqio[seqi].read_seq1; qual_flag = 1; #ifdef SAMTOOLS_BUG sam_pos2 = sam_pos1; sam_pos1 = 0; chr_re2 = chr_re1; chr_re1 = chr_file_n; #endif } cp1 = cigar_p2; cp2 = cigar_p1; seqio[seqi].nm1 = dm_l2 + dm_r2; seqio[seqi].nm2 = dm_op[tid]; } else if(op_rc[tid][v_cnt_i] == 2) { #ifdef FIX_SV sv_add = 1; #endif #ifdef CHAR_CP strcpy(sam_seq1, seqio[seqi].read_seq2); #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 0) strcpy(sam_seq2, seqio[seqi].read_seq1); else { for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); } //if((rcs == 1) || (rcs == 2)) printf("Error: %u\n", rcs); } else { for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); } #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #endif seq2p = sam_seq1; if(ksw_re == 1) { chr_re1 = chr_re1 ^ chr_re2; chr_re2 = chr_re1 ^ chr_re2; chr_re1 = chr_re1 ^ chr_re2; sam_pos1 = sam_pos1 ^ sam_pos2; sam_pos2 = sam_pos1 ^ sam_pos2; sam_pos1 = sam_pos1 ^ sam_pos2; sam_cross = sam_pos2 - read_length1 - sam_pos1; if((sam_cross > insert_dis + devi) || (sam_cross < insert_dis - devi) || (chr_re1 != chr_re2)) { if((other_end_flag) && (rcs == 0)) { sam_flag1 = 65; sam_flag2 = 129; } else { sam_flag1 = 81; sam_flag2 = 161; } } else { if((other_end_flag) && (rcs == 0)) { sam_flag1 = 67; sam_flag2 = 131; } else { sam_flag1 = 83; sam_flag2 = 163; } } seq1p = sam_seq2; } else { sam_flag1 = 69; sam_flag2 = 137; sam_cross = 0; seq1p = seqio[seqi].read_seq1; qual_flag = 1; #ifdef SAMTOOLS_BUG sam_pos2 = sam_pos1; sam_pos1 = 0; chr_re2 = chr_re1; chr_re1 = chr_file_n; #endif } cp1 = cigar_p2; cp2 = cigar_p1; seqio[seqi].nm1 = dm_l2 + dm_r2; seqio[seqi].nm2 = dm_op[tid]; } else { #ifdef FIX_SV sv_add = 2; #endif #ifdef CHAR_CP for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 2) strcpy(sam_seq2, seqio[seqi].read_seq2); else { for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); } //if((rcs == 0) || (rcs == 3)) printf("Error: %u\n", rcs); } else { strcpy(sam_seq2, seqio[seqi].read_seq2); } #else strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #endif seq1p = sam_seq1; seq2p = sam_seq2; if(ksw_re == 1) { sam_cross = sam_pos2 - read_length1 - sam_pos1; if((sam_cross > insert_dis + devi) || (sam_cross < insert_dis - devi) || (chr_re1 != chr_re2)) { if((other_end_flag) && (rcs != 2)) { sam_flag1 = 113; sam_flag2 = 177; } else { sam_flag1 = 81; sam_flag2 = 161; } } else { if((other_end_flag) && (rcs != 2)) { sam_flag1 = 115; sam_flag2 = 179; } else { sam_flag1 = 83; sam_flag2 = 163; } } } else { sam_flag1 = 89; sam_flag2 = 181; sam_cross = 0; qual_flag = 2; #ifdef SAMTOOLS_BUG sam_pos2 = 0; chr_re2 = chr_file_n; #endif } cp1 = cigar_p1; cp2 = cigar_p2; seqio[seqi].nm1 = dm_op[tid]; seqio[seqi].nm2 = dm_l2 + dm_r2; } #ifdef OUTPUT_ARR seqio[seqi].flag1 = sam_flag1; seqio[seqi].flag2 = sam_flag2; //seqio[seqi].chr_re = chr_re; seqio[seqi].chr_re1 = chr_re1; seqio[seqi].chr_re2 = chr_re2; if(sam_pos1 <= 0) { sam_pos1 = 1; } else { if((sam_pos1 + read_length1 - 1) > (chr_end_n[chr_re1] - chr_end_n[chr_re1 - 1])) sam_pos1 = chr_end_n[chr_re1] - chr_end_n[chr_re1 - 1] - 1 - read_length1; } if(sam_pos2 <= 0) { sam_pos2 = 1; } else { if((sam_pos2 + read_length2 - 1) > (chr_end_n[chr_re2] - chr_end_n[chr_re2 - 1])) sam_pos2 = chr_end_n[chr_re2] - chr_end_n[chr_re2 - 1] - 1 - read_length2; } seqio[seqi].pos1 = sam_pos1; seqio[seqi].pos2 = sam_pos2; seqio[seqi].cross = sam_cross; strcpy(pr_cigar1_buffer[seqi], cp1); seqio[seqi].cigar1 = pr_cigar1_buffer[seqi]; strcpy(pr_cigar2_buffer[seqi], cp2); seqio[seqi].cigar2 = pr_cigar2_buffer[seqi]; if((sam_flag1 == 99) || (sam_flag1 == 117) || (sam_flag1 == 97)) { strcpy(read_rev_buffer[seqi], seq2p); read_rev_buffer[seqi][read_length2] = '\0'; seqio[seqi].seq2 = read_rev_buffer[seqi]; seqio[seqi].seq1 = seqio[seqi].read_seq1; strrev1(qual2_buffer[seqi]); } else if((sam_flag1 == 83) || (sam_flag1 == 89) || (sam_flag1 == 81)) { strcpy(read_rev_buffer[seqi], seq1p); read_rev_buffer[seqi][read_length1] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; seqio[seqi].seq2 = seqio[seqi].read_seq2; strrev1(qual1_buffer[seqi]); } else if((sam_flag1 == 113) || (sam_flag1 == 115)) { strcpy(read_rev_buffer[seqi], seq1p); read_rev_buffer[seqi][read_length1] = '\0'; strcpy(read_rev_buffer_1[seqi], seq2p); read_rev_buffer_1[seqi][read_length2] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; seqio[seqi].seq2 = read_rev_buffer_1[seqi]; } else { seqio[seqi].seq1 = seqio[seqi].read_seq1; seqio[seqi].seq2 = seqio[seqi].read_seq2; } #endif } lv_re1f = dm_op[tid]; xa_i_1 = 0; xa_i_2 = 0; for(va_cnt_i = 1; va_cnt_i < v_cnt; va_cnt_i++) { #ifdef ALTER_DEBUG_ANCHOR v_cnt_i = seed_length_arr[tid][va_cnt_i].index; #else v_cnt_i = va_cnt_i; #endif #ifdef REDUCE_ANCHOR if(op_mask[v_cnt_i] == 1) continue; op_mask[v_cnt_i] = 1; #endif x = op_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } if(chr_re) sam_pos1 = op_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; else { sam_pos1 = op_vector_pos1[tid][v_cnt_i]; chr_re = 1; } //chr_res[tid][xa_i] = chr_re; if(op_rc[tid][v_cnt_i] == 0) { #ifdef OUPUT_SINGLE_REPEAT #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif ksw_s = x + end_dis1[tid] - devi; ksw_e = x + insert_dis + devi; cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else if(op_rc[tid][v_cnt_i] == 1) { #ifdef OUPUT_SINGLE_REPEAT #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif ksw_s = x - (end_dis1[tid] + devi); ksw_e = x - (end_dis1[tid] - devi) + read_length1; cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else if(op_rc[tid][v_cnt_i] == 2) { #ifdef OUPUT_SINGLE_REPEAT #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif ksw_s = x + (end_dis2[tid] - devi); ksw_e = x + insert_dis + devi; cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } else { #ifdef OUPUT_SINGLE_REPEAT #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif ksw_s = x - (end_dis2[tid] + devi); ksw_e = x - (end_dis2[tid] - devi) + read_length2; cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } #ifdef ANCHOR_HASH_ALI anchor_hash_p = anchor_hash[tid][op_rc[tid][v_cnt_i]]; anchor_array_p = anchor_array[tid][op_rc[tid][v_cnt_i]]; anchor_point_p = anchor_point[tid][op_rc[tid][v_cnt_i]]; anchor_pos_p = anchor_pos[tid][op_rc[tid][v_cnt_i]]; #endif d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = op_dm_l1[tid][v_cnt_i]; s_r_o_r = op_dm_r1[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m_1); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length_1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length_1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length_1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p1 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length_1) { sn = sprintf(cigar_p1 + snt, "%uS", read_length_1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p1[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p1[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_1 != cigar_len) { if(read_length_1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_1); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m_1); } else { cigar_len_re = cigar_len_tmp + (read_length_1 - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos1 = sam_pos1 + i_n1 - d_n1 + s_offset1; ksw_re = 0; #ifdef REDUCE_ANCHOR other_end_flag = 0; #endif #ifdef ANCHOR_HASH_ALI buffer_i = 0; r_b_v = 0; for(base_i = ksw_s - 1; base_i < ksw_e - k_anchor; base_i += anchor_seed_d) { if(base_i + k_anchor - 1 < r_b_v) continue; base_re = (base_i & 0X1f); if(base_re <= k_anchor_re) { anchor_ref = ((buffer_ref_seq[base_i >> 5] >> ((k_anchor_re - base_re) << 1)) & anchor_mask); } else { anchor_ref = (((buffer_ref_seq[base_i >> 5] & anchor_mask_boundary[32 - base_re]) << ((base_re - k_anchor_re) << 1)) | (buffer_ref_seq[(base_i >> 5) + 1] >> ((32 + k_anchor_re - base_re) << 1))); } max_right = 0; for(tra_i = 0; tra_i < (anchor_hash_p[anchor_ref >> 4] & 0X1f); tra_i++) { array_index = (anchor_hash_p[anchor_ref >> 4] >> 5) + tra_i; if(anchor_array_p[array_index] == (anchor_ref & 0Xf)) { max_seed_length = 0; for(print_i = anchor_point_p[array_index]; print_i < anchor_point_p[array_index + 1]; print_i++) { //extension on both sides for(left_i = anchor_pos_p[print_i] - 1, base_i_off_l = base_i - 1; (left_i >= 0) && (base_i_off_l >= ksw_s - 1); left_i--, base_i_off_l--) { #ifdef CHAR_CP if(((read_bit_2[tid][left_i >> 5] >> ((31 - (left_i & 0X1f)) << 1)) & 0X3) != ((buffer_ref_seq[base_i_off_l >> 5] >> ((31 - (base_i_off_l & 0X1f)) << 1)) & 0X3)) break; #else if(sam_seq2[left_i] != Dna5Tochar[((buffer_ref_seq[base_i_off_l >> 5] >> ((31 - (base_i_off_l & 0X1f)) << 1)) & 0X3)]) break; #endif } for(right_i = anchor_pos_p[print_i] + k_anchor, base_i_off_r = base_i + k_anchor; (right_i < read_length_2) && (base_i_off_r < ksw_e); right_i++, base_i_off_r++) { #ifdef CHAR_CP if(((read_bit_2[tid][right_i >> 5] >> ((31 - (right_i & 0X1f)) << 1)) & 0X3) != ((buffer_ref_seq[base_i_off_r >> 5] >> ((31 - (base_i_off_r & 0X1f)) << 1)) & 0X3)) break; #else if(sam_seq2[right_i] != Dna5Tochar[((buffer_ref_seq[base_i_off_r >> 5] >> ((31 - (base_i_off_r & 0X1f)) << 1)) & 0X3)]) break; #endif } seed_length = right_i - left_i - 1; if(seed_length > max_seed_length) { max_seed_length = seed_length; max_right = base_i_off_r; } anchor_seed_buffer[tid][buffer_i].read_left_off = left_i; anchor_seed_buffer[tid][buffer_i].read_right_off = right_i; anchor_seed_buffer[tid][buffer_i].ref_left_off = base_i_off_l; anchor_seed_buffer[tid][buffer_i].ref_right_off = base_i_off_r; anchor_seed_buffer[tid][buffer_i].seed_length = seed_length; buffer_i++; } break; } } r_b_v = max_right; } if((buffer_i > 0) && (max_seed_length > anchor_seed_length_thr)) { qsort(anchor_seed_buffer[tid], buffer_i, sizeof(anchor_seed), comepare_anchor_seed); //LV left_i = anchor_seed_buffer[tid][0].read_left_off; right_i = anchor_seed_buffer[tid][0].read_right_off; base_i_off_l = anchor_seed_buffer[tid][0].ref_left_off; base_i_off_r = anchor_seed_buffer[tid][0].ref_right_off; d_n1 = 0; i_n1 = 0; if((left_i == -1) && (right_i == read_length_2)) { strcpy(cigar_p2, cigar_m_2); } else //indel { #ifdef LV_CCIGAR #ifdef CHAR_CP for(bit_char_i = left_i, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = base_i_off_l, read_b_i = 0; bit_char_i > base_i_off_l - left_i - 33; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = left_i, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for(bit_char_i = base_i_off_l, read_b_i = 0; bit_char_i > base_i_off_l - left_i - 33; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif dm1 = computeEditDistanceWithCigar_s_left(ali_ref_seq[tid], left_i + 33, read_char[tid], left_i + 1, lv_k_2, cigarBuf1, f_cigarn, L[tid], &s_offset2);//, 0 #ifdef CHAR_CP for(bit_char_i = right_i, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = base_i_off_r, read_b_i = 0; bit_char_i < base_i_off_r + read_length_2 - right_i + 32; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = right_i, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for(bit_char_i = base_i_off_r, read_b_i = 0; bit_char_i < base_i_off_r + read_length_2 - right_i + 32; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif dm2 = computeEditDistanceWithCigar_s(ali_ref_seq[tid], read_length_2 - right_i + 32, read_char[tid], read_length_2 - right_i, lv_k_2, cigarBuf2, f_cigarn, L[tid]);//, 0 #endif //deal with cigar of LV //deal with front and back lv cigar m_m_n = anchor_seed_buffer[tid][0].seed_length; strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok (cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; if((left_i != -1) && (right_i != read_length_2)) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if(left_i == -1) { if(b_cigar[pchl] == 'M') sn = sprintf(cigar_p2, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); else sn = sprintf(cigar_p2, "%uM%s", m_m_n, b_cigar); snt += sn; } else { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_2 != cigar_len) { if(read_length_2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m_2); } else { cigar_len_re = cigar_len_tmp + (read_length_2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset2 = 0; #endif sam_pos2 = base_i_off_l - left_i + i_n1 - d_n1 - chr_end_n[chr_re - 1] + 2 + s_offset2; ksw_re = 1; lv_re2f = dm1 + dm2; } else { #ifdef REDUCE_ANCHOR if((op_rc[tid][v_cnt_i] == 0) || (op_rc[tid][v_cnt_i] == 3)) { other_end_flag = 0; while(tra2_i < anchor_n2) { rcs = rcs2[tid][tra2_i]; rs = rs2[tid][tra2_i]; ls = ls2[tid][tra2_i]; sam_pos2 = poses2[tid][tra2_i]; lv_re2f = dms2[tid][tra2_i]; if(orders2[tid][tra2_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders2[tid][tra2_i] - MAX_REDUCE_ANCHOR_NUM; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; if(ops_mask[v_cnt_i_tmp] == 0) { ops_mask[v_cnt_i_tmp] = 1; other_end_flag = 1; tra2_i++; break; } } else { v_cnt_i_tmp = orders2[tid][tra2_i]; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; if(op_mask[v_cnt_i_tmp] == 0) { op_mask[v_cnt_i_tmp] = 1; other_end_flag = 1; tra2_i++; break; } } tra2_i++; } } else { other_end_flag = 0; while(tra1_i < anchor_n1) { rcs = rcs1[tid][tra1_i]; rs = rs1[tid][tra1_i]; ls = ls1[tid][tra1_i]; sam_pos2 = poses1[tid][tra1_i]; lv_re2f = dms1[tid][tra1_i]; if(orders1[tid][tra1_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders1[tid][tra1_i] - MAX_REDUCE_ANCHOR_NUM; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; if(ops_mask[v_cnt_i_tmp] == 0) { ops_mask[v_cnt_i_tmp] = 1; tra1_i++; other_end_flag = 1; break; } } else { v_cnt_i_tmp = orders1[tid][tra1_i]; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; if(op_mask[v_cnt_i_tmp] == 0) { op_mask[v_cnt_i_tmp] = 1; tra1_i++; other_end_flag = 1; break; } } tra1_i++; } } if(other_end_flag) { x = sam_pos2; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos2 = x - chr_end_n[chr_re - 1] + 1; if(rcs == 0) { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); /* for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else if(rcs == 1) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else if(rcs == 2) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); /* for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } else { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = ls; s_r_o_r = rs; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m_2); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length_1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length_1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length_1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length_1) { sn = sprintf(cigar_p2 + snt, "%uS", read_length_1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p2[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_1 != cigar_len) { if(read_length_1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_1); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m_1); } else { cigar_len_re = cigar_len_tmp + (read_length_1 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos2 = sam_pos2 + i_n1 - d_n1 + s_offset1; ksw_re = 1; } else { sam_pos2 = sam_pos1; #ifdef PICARD_BUG strcpy(cigar_p2, cigar_p1); #else strcpy(cigar_p2, "*"); #endif ksw_re = 0; lv_re2f = 0; } #else sam_pos2 = sam_pos1; #ifdef PICARD_BUG strcpy(cigar_p2, cigar_p1); #else strcpy(cigar_p2, "*"); #endif ksw_re = 0; lv_re2f = 0; #endif } #endif if(op_rc[tid][v_cnt_i] == 0) { cp1 = cigar_p1; cp2 = cigar_p2; xa_d1s[tid][xa_i_1] = '+'; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 2) xa_d2s[tid][xa_i_2] = '+'; else xa_d2s[tid][xa_i_2] = '-'; } else xa_d2s[tid][xa_i_2] = '-'; #else xa_d2s[tid][xa_i_2] = '-'; #endif lv_re1b = lv_re1f; lv_re2b = lv_re2f; } else if(op_rc[tid][v_cnt_i] == 1) { if(ksw_re == 1) { sam_pos1 = sam_pos1 ^ sam_pos2; sam_pos2 = sam_pos1 ^ sam_pos2; sam_pos1 = sam_pos1 ^ sam_pos2; } cp1 = cigar_p2; cp2 = cigar_p1; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 0) xa_d1s[tid][xa_i_1] = '+'; else xa_d1s[tid][xa_i_1] = '-'; } else xa_d1s[tid][xa_i_1] = '+'; #else xa_d1s[tid][xa_i_1] = '+'; #endif xa_d2s[tid][xa_i_2] = '-'; lv_re1b = lv_re2f; lv_re2b = lv_re1f; } else if(op_rc[tid][v_cnt_i] == 2) { if(ksw_re == 1) { sam_pos1 = sam_pos1 ^ sam_pos2; sam_pos2 = sam_pos1 ^ sam_pos2; sam_pos1 = sam_pos1 ^ sam_pos2; } cp1 = cigar_p2; cp2 = cigar_p1; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 0) xa_d1s[tid][xa_i_1] = '+'; else xa_d1s[tid][xa_i_1] = '-'; } else xa_d1s[tid][xa_i_1] = '-'; #else xa_d1s[tid][xa_i_1] = '-'; #endif xa_d2s[tid][xa_i_2] = '+'; lv_re1b = lv_re2f; lv_re2b = lv_re1f; } else { cp1 = cigar_p1; cp2 = cigar_p2; xa_d1s[tid][xa_i_1] = '-'; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 2) xa_d2s[tid][xa_i_2] = '+'; else xa_d2s[tid][xa_i_2] = '-'; } else xa_d2s[tid][xa_i_2] = '+'; #else xa_d2s[tid][xa_i_2] = '+'; #endif lv_re1b = lv_re1f; lv_re2b = lv_re2f; } if(sam_pos1 <= 0) sam_pos1 = 1; if(sam_pos2 <= 0) sam_pos2 = 1; /* if((sam_flag1 == 117) || (sam_flag1 == 69)) { #ifdef PICARD_BUG //strcpy(cigar_p1s[tid][xa_i], cp2); #else //strcpy(cigar_p1s[tid][xa_i], "*"); #endif strcpy(cigar_p2s[tid][xa_i_2], cp2); lv_re2s[tid][xa_i_2] = lv_re2b; chr_res[tid][xa_i_2] = chr_re; sam_pos2s[tid][xa_i_2] = (uint32_t )sam_pos2; xa_i_2++; } else if((sam_flag1 == 73) || (sam_flag1 == 89)) { strcpy(cigar_p1s[tid][xa_i_1], cp1); lv_re1s[tid][xa_i_1] = lv_re1b; chr_res[tid][xa_i_1] = chr_re; sam_pos1s[tid][xa_i_1] = (uint32_t )sam_pos1; xa_i_1++; #ifdef PICARD_BUG //strcpy(cigar_p2s[tid][xa_i], cp1); #else //strcpy(cigar_p2s[tid][xa_i], "*"); #endif } else { strcpy(cigar_p1s[tid][xa_i_1], cp1); strcpy(cigar_p2s[tid][xa_i_2], cp2); lv_re1s[tid][xa_i_1] = lv_re1b; lv_re2s[tid][xa_i_2] = lv_re2b; chr_res[tid][xa_i_1] = chr_re; sam_pos1s[tid][xa_i_1] = (uint32_t )sam_pos1; sam_pos2s[tid][xa_i_2] = (uint32_t )sam_pos2; xa_i_1++; xa_i_2++; } */ strcpy(cigar_p1s[tid][xa_i_1], cp1); strcpy(cigar_p2s[tid][xa_i_2], cp2); lv_re1s[tid][xa_i_1] = lv_re1b; lv_re2s[tid][xa_i_2] = lv_re2b; chr_res[tid][xa_i_1] = chr_re; sam_pos1s[tid][xa_i_1] = (uint32_t )sam_pos1; sam_pos2s[tid][xa_i_2] = (uint32_t )sam_pos2; xa_i_1++; xa_i_2++; } lv_re1f = dm_ops[tid]; #ifdef ALT_ALL #ifdef ALL_ALL_SINGLE for(v_cnt_i = 0; v_cnt_i < vs_cnt; v_cnt_i++) #else for(v_cnt_i = 0; (v_cnt_i < vs_cnt) && (dm_op[tid] + 3 > dm_ops[tid]); v_cnt_i++) #endif #else for(v_cnt_i = 0; (v_cnt_i < vs_cnt) && (v_cnt < 2) && (dm_op[tid] + 3 > dm_ops[tid]); v_cnt_i++) #endif { #ifdef REDUCE_ANCHOR if(ops_mask[v_cnt_i] == 1) continue; ops_mask[v_cnt_i] = 1; #endif x = ops_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } if(chr_re) sam_pos1 = ops_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; else { sam_pos1 = ops_vector_pos1[tid][v_cnt_i]; chr_re = 1; } //chr_res[tid][xa_i] = chr_re; if(ops_rc[tid][v_cnt_i] == 0) { #ifdef OUPUT_SINGLE_REPEAT2 #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif ksw_s = x + end_dis1[tid] - devi; ksw_e = x + insert_dis + devi; cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else if(ops_rc[tid][v_cnt_i] == 1) { #ifdef OUPUT_SINGLE_REPEAT2 #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif ksw_s = x - (end_dis1[tid] + devi); ksw_e = x - (end_dis1[tid] - devi) + read_length1; cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else if(ops_rc[tid][v_cnt_i] == 2) { #ifdef OUPUT_SINGLE_REPEAT2 #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif ksw_s = x + (end_dis2[tid] - devi); ksw_e = x + insert_dis + devi; cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } else { #ifdef OUPUT_SINGLE_REPEAT2 #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif ksw_s = x - (end_dis2[tid] + devi); ksw_e = x - (end_dis2[tid] - devi) + read_length2; cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } #ifdef ANCHOR_HASH_ALI anchor_hash_p = anchor_hash[tid][ops_rc[tid][v_cnt_i]]; anchor_array_p = anchor_array[tid][ops_rc[tid][v_cnt_i]]; anchor_point_p = anchor_point[tid][ops_rc[tid][v_cnt_i]]; anchor_pos_p = anchor_pos[tid][ops_rc[tid][v_cnt_i]]; #endif d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = ops_dm_l1[tid][v_cnt_i]; s_r_o_r = ops_dm_r1[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m_1); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length_1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length_1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length_1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p1 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length_1) { sn = sprintf(cigar_p1 + snt, "%uS", read_length_1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p1[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 +sn; } else if(cigar_p1[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_1 != cigar_len) { if(read_length_1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_1); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m_1); } else { cigar_len_re = cigar_len_tmp + (read_length_1 - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos1 = sam_pos1 + i_n1 - d_n1 + s_offset1; ksw_re = 0; #ifdef REDUCE_ANCHOR other_end_flag = 0; #endif #ifdef ANCHOR_HASH_ALI buffer_i = 0; r_b_v = 0; for(base_i = ksw_s - 1; base_i < ksw_e - k_anchor; base_i += anchor_seed_d) { if(base_i + k_anchor - 1 < r_b_v) continue; base_re = (base_i & 0X1f); if(base_re <= k_anchor_re) { anchor_ref = ((buffer_ref_seq[base_i >> 5] >> ((k_anchor_re - base_re) << 1)) & anchor_mask); } else { anchor_ref = (((buffer_ref_seq[base_i >> 5] & anchor_mask_boundary[32 - base_re]) << ((base_re - k_anchor_re) << 1)) | (buffer_ref_seq[(base_i >> 5) + 1] >> ((32 + k_anchor_re - base_re) << 1))); } max_right = 0; for(tra_i = 0; tra_i < (anchor_hash_p[anchor_ref >> 4] & 0X1f); tra_i++) { array_index = (anchor_hash_p[anchor_ref >> 4] >> 5) + tra_i; if(anchor_array_p[array_index] == (anchor_ref & 0Xf)) { max_seed_length = 0; for(print_i = anchor_point_p[array_index]; print_i < anchor_point_p[array_index + 1]; print_i++) { //extension on both sides for(left_i = anchor_pos_p[print_i] - 1, base_i_off_l = base_i - 1; (left_i >= 0) && (base_i_off_l >= ksw_s - 1); left_i--, base_i_off_l--) { #ifdef CHAR_CP if(((read_bit_2[tid][left_i >> 5] >> ((31 - (left_i & 0X1f)) << 1)) & 0X3) != ((buffer_ref_seq[base_i_off_l >> 5] >> ((31 - (base_i_off_l & 0X1f)) << 1)) & 0X3)) break; #else if(sam_seq2[left_i] != Dna5Tochar[((buffer_ref_seq[base_i_off_l >> 5] >> ((31 - (base_i_off_l & 0X1f)) << 1)) & 0X3)]) break; #endif } for(right_i = anchor_pos_p[print_i] + k_anchor, base_i_off_r = base_i + k_anchor; (right_i < read_length_2) && (base_i_off_r < ksw_e); right_i++, base_i_off_r++) { #ifdef CHAR_CP if(((read_bit_2[tid][right_i >> 5] >> ((31 - (right_i & 0X1f)) << 1)) & 0X3) != ((buffer_ref_seq[base_i_off_r >> 5] >> ((31 - (base_i_off_r & 0X1f)) << 1)) & 0X3)) break; #else if(sam_seq2[right_i] != Dna5Tochar[((buffer_ref_seq[base_i_off_r >> 5] >> ((31 - (base_i_off_r & 0X1f)) << 1)) & 0X3)]) break; #endif } seed_length = right_i - left_i - 1; if(seed_length > max_seed_length) { max_seed_length = seed_length; max_right = base_i_off_r; } anchor_seed_buffer[tid][buffer_i].read_left_off = left_i; anchor_seed_buffer[tid][buffer_i].read_right_off = right_i; anchor_seed_buffer[tid][buffer_i].ref_left_off = base_i_off_l; anchor_seed_buffer[tid][buffer_i].ref_right_off = base_i_off_r; anchor_seed_buffer[tid][buffer_i].seed_length = seed_length; buffer_i++; } break; } } r_b_v = max_right; } if((buffer_i > 0) && (max_seed_length > anchor_seed_length_thr)) { qsort(anchor_seed_buffer[tid], buffer_i, sizeof(anchor_seed), comepare_anchor_seed); //LV left_i = anchor_seed_buffer[tid][0].read_left_off; right_i = anchor_seed_buffer[tid][0].read_right_off; base_i_off_l = anchor_seed_buffer[tid][0].ref_left_off; base_i_off_r = anchor_seed_buffer[tid][0].ref_right_off; d_n1 = 0; i_n1 = 0; if((left_i == -1) && (right_i == read_length_2)) { strcpy(cigar_p2, cigar_m_2); } else //indel { #ifdef LV_CCIGAR #ifdef CHAR_CP for(bit_char_i = left_i, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = base_i_off_l, read_b_i = 0; bit_char_i > base_i_off_l - left_i - 33; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = left_i, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for(bit_char_i = base_i_off_l, read_b_i = 0; bit_char_i > base_i_off_l - left_i - 33; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif dm1 = computeEditDistanceWithCigar_s_left(ali_ref_seq[tid], left_i + 33, read_char[tid], left_i + 1, lv_k_2, cigarBuf1, f_cigarn, L[tid], &s_offset2);//, 0 #ifdef CHAR_CP for(bit_char_i = right_i, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = base_i_off_r, read_b_i = 0; bit_char_i < base_i_off_r + read_length_2 - right_i + 32; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = right_i, read_b_i = 0; bit_char_i < read_length_2; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for(bit_char_i = base_i_off_r, read_b_i = 0; bit_char_i < base_i_off_r + read_length_2 - right_i + 32; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((buffer_ref_seq[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif dm2 = computeEditDistanceWithCigar_s(ali_ref_seq[tid], read_length_2 - right_i + 32, read_char[tid], read_length_2 - right_i, lv_k_2, cigarBuf2, f_cigarn, L[tid]);//, 0 #endif //deal with cigar of LV //deal with front and back lv cigar m_m_n = anchor_seed_buffer[tid][0].seed_length; strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok (cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; if((left_i != -1) && (right_i != read_length_2)) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if(left_i == -1) { if(b_cigar[pchl] == 'M') sn = sprintf(cigar_p2, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); else sn = sprintf(cigar_p2, "%uM%s", m_m_n, b_cigar); snt += sn; } else { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_2 != cigar_len) { if(read_length_2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m_2); } else { cigar_len_re = cigar_len_tmp + (read_length_2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset2 = 0; #endif sam_pos2 = base_i_off_l - left_i + i_n1 - d_n1 - chr_end_n[chr_re - 1] + 2 + s_offset2; ksw_re = 1; lv_re2f = dm1 + dm2; } else { #ifdef REDUCE_ANCHOR if((ops_rc[tid][v_cnt_i] == 0) || (ops_rc[tid][v_cnt_i] == 3)) { other_end_flag = 0; while(tra2_i < anchor_n2) { rcs = rcs2[tid][tra2_i]; rs = rs2[tid][tra2_i]; ls = ls2[tid][tra2_i]; sam_pos2 = poses2[tid][tra2_i]; lv_re2f = dms2[tid][tra2_i]; if(orders2[tid][tra2_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders2[tid][tra2_i] - MAX_REDUCE_ANCHOR_NUM; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; if(ops_mask[v_cnt_i_tmp] == 0) { ops_mask[v_cnt_i_tmp] = 1; tra2_i++; other_end_flag = 1; break; } } else { v_cnt_i_tmp = orders2[tid][tra2_i]; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; if(op_mask[v_cnt_i_tmp] == 0) { op_mask[v_cnt_i_tmp] = 1; tra2_i++; other_end_flag = 1; break; } } tra2_i++; } } else { other_end_flag = 0; while(tra1_i < anchor_n1) { rcs = rcs1[tid][tra1_i]; rs = rs1[tid][tra1_i]; ls = ls1[tid][tra1_i]; sam_pos2 = poses1[tid][tra1_i]; lv_re2f = dms1[tid][tra1_i]; if(orders1[tid][tra1_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders1[tid][tra1_i] - MAX_REDUCE_ANCHOR_NUM; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; if(ops_mask[v_cnt_i_tmp] == 0) { ops_mask[v_cnt_i_tmp] = 1; tra1_i++; other_end_flag = 1; break; } } else { v_cnt_i_tmp = orders1[tid][tra1_i]; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; if(op_mask[v_cnt_i_tmp] == 0) { op_mask[v_cnt_i_tmp] = 1; tra1_i++; other_end_flag = 1; break; } } tra1_i++; } } if(other_end_flag) { x = sam_pos2; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos2 = x - chr_end_n[chr_re - 1] + 1; if(rcs == 0) { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); /* for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else if(rcs == 1) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else if(rcs == 2) { #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); /* for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif cigar_m_1 = cigar_m2[tid]; cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; read_length_1 = read_length2; read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } else { #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif cigar_m_1 = cigar_m1[tid]; cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; read_length_1 = read_length1; read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = ls; s_r_o_r = rs; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m_2); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length_1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length_1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length_1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length_1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length_1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length_1) { sn = sprintf(cigar_p2 + snt, "%uS", read_length_1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p2[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length_1 != cigar_len) { if(read_length_1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length_1); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m_1); } else { cigar_len_re = cigar_len_tmp + (read_length_1 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos2 = sam_pos2 + i_n1 - d_n1 + s_offset1; ksw_re = 1; } else { sam_pos2 = sam_pos1; #ifdef PICARD_BUG strcpy(cigar_p2, cigar_p1); #else strcpy(cigar_p2, "*"); #endif ksw_re = 0; lv_re2f = 0; } #else sam_pos2 = sam_pos1; #ifdef PICARD_BUG strcpy(cigar_p2, cigar_p1); #else strcpy(cigar_p2, "*"); #endif ksw_re = 0; lv_re2f = 0; #endif } #endif if(ops_rc[tid][v_cnt_i] == 0) { cp1 = cigar_p1; cp2 = cigar_p2; xa_d1s[tid][xa_i_1] = '+'; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 2) xa_d2s[tid][xa_i_2] = '+'; else xa_d2s[tid][xa_i_2] = '-'; } else xa_d2s[tid][xa_i_2] = '-'; #else xa_d2s[tid][xa_i_2] = '-'; #endif lv_re1b = lv_re1f; lv_re2b = lv_re2f; } else if(ops_rc[tid][v_cnt_i] == 1) { if(ksw_re == 1) { sam_pos1 = sam_pos1 ^ sam_pos2; sam_pos2 = sam_pos1 ^ sam_pos2; sam_pos1 = sam_pos1 ^ sam_pos2; } cp1 = cigar_p2; cp2 = cigar_p1; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 0) xa_d1s[tid][xa_i_1] = '+'; else xa_d1s[tid][xa_i_1] = '-'; } else xa_d1s[tid][xa_i_1] = '+'; #else xa_d1s[tid][xa_i_1] = '+'; #endif xa_d2s[tid][xa_i_2] = '-'; lv_re1b = lv_re2f; lv_re2b = lv_re1f; } else if(ops_rc[tid][v_cnt_i] == 2) { if(ksw_re == 1) { sam_pos1 = sam_pos1 ^ sam_pos2; sam_pos2 = sam_pos1 ^ sam_pos2; sam_pos1 = sam_pos1 ^ sam_pos2; } cp1 = cigar_p2; cp2 = cigar_p1; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 0) xa_d1s[tid][xa_i_1] = '+'; else xa_d1s[tid][xa_i_1] = '-'; } else xa_d1s[tid][xa_i_1] = '-'; #else xa_d1s[tid][xa_i_1] = '-'; #endif xa_d2s[tid][xa_i_2] = '+'; lv_re1b = lv_re2f; lv_re2b = lv_re1f; } else { cp1 = cigar_p1; cp2 = cigar_p2; xa_d1s[tid][xa_i_1] = '-'; #ifdef REDUCE_ANCHOR if(other_end_flag) { if(rcs == 2) xa_d2s[tid][xa_i_2] = '+'; else xa_d2s[tid][xa_i_2] = '-'; } else xa_d2s[tid][xa_i_2] = '+'; #else xa_d2s[tid][xa_i_2] = '+'; #endif lv_re1b = lv_re1f; lv_re2b = lv_re2f; } if(sam_pos1 <= 0) sam_pos1 = 1; if(sam_pos2 <= 0) sam_pos2 = 1; /* if((sam_flag1 == 117) || (sam_flag1 == 69)) { #ifdef PICARD_BUG //strcpy(cigar_p1s[tid][xa_i], cp2); #else //strcpy(cigar_p1s[tid][xa_i], "*"); #endif strcpy(cigar_p2s[tid][xa_i_2], cp2); lv_re2s[tid][xa_i_2] = lv_re2b; chr_res[tid][xa_i_2] = chr_re; sam_pos2s[tid][xa_i_2] = (uint32_t )sam_pos2; xa_i_2++; } else if((sam_flag1 == 73) || (sam_flag1 == 89)) { strcpy(cigar_p1s[tid][xa_i_1], cp1); lv_re1s[tid][xa_i_1] = lv_re1b; chr_res[tid][xa_i_1] = chr_re; sam_pos1s[tid][xa_i_1] = (uint32_t )sam_pos1; xa_i_1++; #ifdef PICARD_BUG //strcpy(cigar_p2s[tid][xa_i], cp1); #else //strcpy(cigar_p2s[tid][xa_i], "*"); #endif } else { strcpy(cigar_p1s[tid][xa_i_1], cp1); strcpy(cigar_p2s[tid][xa_i_2], cp2); lv_re1s[tid][xa_i_1] = lv_re1b; lv_re2s[tid][xa_i_2] = lv_re2b; chr_res[tid][xa_i_1] = chr_re; sam_pos1s[tid][xa_i_1] = (uint32_t )sam_pos1; sam_pos2s[tid][xa_i_2] = (uint32_t )sam_pos2; xa_i_1++; xa_i_2++; } */ strcpy(cigar_p1s[tid][xa_i_1], cp1); strcpy(cigar_p2s[tid][xa_i_2], cp2); lv_re1s[tid][xa_i_1] = lv_re1b; lv_re2s[tid][xa_i_2] = lv_re2b; chr_res[tid][xa_i_1] = chr_re; sam_pos1s[tid][xa_i_1] = (uint32_t )sam_pos1; sam_pos2s[tid][xa_i_2] = (uint32_t )sam_pos2; xa_i_1++; xa_i_2++; } #else v_cnt = 0; #endif seqio[seqi].v_cnt = v_cnt; if(v_cnt > 0) { if(qual_flag == 1) xa_i_1 = 0; if(qual_flag == 2) xa_i_2 = 0; //seqio[seqi].xa_n = xa_i; seqio[seqi].xa_n_p1 = xa_i_1; seqio[seqi].xa_n_p2 = xa_i_2; seqio[seqi].xa_n1 = 0; seqio[seqi].xa_n2 = 0; if((v_cnt == 1) || ((xa_i_1 == 0) && (xa_i_2 == 0))) { if(xa_i_1) seqio[seqi].qualc1 = 20; else seqio[seqi].qualc1 = 60; if(xa_i_2) seqio[seqi].qualc2 = 20; else seqio[seqi].qualc2 = 60; } else { seqio[seqi].qualc1 = 0; seqio[seqi].qualc2 = 0; } if(qual_flag == 1) seqio[seqi].qualc1 = 0; if(qual_flag == 2) seqio[seqi].qualc2 = 0; memcpy(chr_res_buffer[seqi], chr_res[tid], (xa_i_1 > xa_i_2 ? xa_i_1:xa_i_2) << 2); seqio[seqi].chr_res = chr_res_buffer[seqi]; #ifdef FIX_SV seqio[seqi].xa_n_x1 = 0; seqio[seqi].xa_n_x2 = 0; tra_i_n = 0; if(sv_add == 1) { for(tra_i = tra1_i; (tra_i_n < 1) && (tra_i < anchor_n1) && ((xa_i_1 + tra_i_n) < CUS_MAX_OUTPUT_ALI2); tra_i++) { if(orders1[tid][tra_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders1[tid][tra_i] - MAX_REDUCE_ANCHOR_NUM; if(ops_mask[v_cnt_i_tmp] == 1) continue; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; } else { v_cnt_i_tmp = orders1[tid][tra_i]; if(op_mask[v_cnt_i_tmp] == 1) continue; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; } sam_pos2 = poses1[tid][tra_i]; x = sam_pos2; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos2 = x - chr_end_n[chr_re - 1] + 1; rcs = rcs1[tid][tra_i]; rs = rs1[tid][tra_i]; ls = ls1[tid][tra_i]; chr_res_buffer1[seqi][tra_i_n] = chr_re; if(rcs == 0) { xa_d1s[tid][xa_i_1 + tra_i_n] = '+'; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); /* for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif //cigar_m_1 = cigar_m1[tid]; //cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; //read_length_1 = read_length1; //read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else { xa_d1s[tid][xa_i_1 + tra_i_n] = '-'; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif //cigar_m_1 = cigar_m1[tid]; //cigar_m_2 = cigar_m2[tid]; lv_k_1 = lv_k1; lv_k_2 = lv_k2; //read_length_1 = read_length1; //read_length_2 = read_length2; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_r_o_l = ls; s_r_o_r = rs; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m1[tid]); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length1 - s_r_o_l - 1; } else//4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); if(str_o[s_o - 1] == 'S') f_cigar[f_cigarn - f_c - 1] = 'S'; else f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length1) { sn = sprintf(cigar_p2 + snt, "%uS", read_length1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p2[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR #ifdef FIX_SA sv_s_len = 0; #endif cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; #ifdef FIX_SA if(cigar_p2[s_o_tmp - 1] == 'S') sv_s_len += cigar_len_tmp; #endif } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length1 != cigar_len) { if(read_length1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length1); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m1[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length1 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos2 = sam_pos2 + i_n1 - d_n1 + s_offset1; if(sam_pos2 == seqio[seqi].pos1) continue; if(sam_pos2 <= 0) sam_pos2 = 1; if(sv_s_len_p > sv_s_len) { chr_res_buffer1[seqi][tra_i_n] = seqio[seqi].chr_re1; seqio[seqi].chr_re1 = chr_re; sam_pos1s[tid][xa_i_1 + tra_i_n] = seqio[seqi].pos1; if((sam_pos2 + read_length1 - 1) > (chr_end_n[chr_re] - chr_end_n[chr_re - 1])) sam_pos2 = chr_end_n[chr_re] - chr_end_n[chr_re - 1] - 1 - read_length1; seqio[seqi].pos1 = sam_pos2; lv_re1s[tid][xa_i_1 + tra_i_n] = seqio[seqi].nm1; seqio[seqi].nm1 = dms1[tid][tra_i]; if(seqio[seqi].flag1 & 0X10) xa_d1s[tid][xa_i_1 + tra_i_n] = '-'; else xa_d1s[tid][xa_i_1 + tra_i_n] = '+'; if(rcs == 0) { if(op_rc_tmp == 1) //1+ 2- { seqio[seqi].flag1 = 97; seqio[seqi].flag2 = 145; //xa_d1s[tid][xa_i_1 + tra_i_n] = '+'; if(seqio[seqi].pos2 > sam_pos2) sam_cross = seqio[seqi].pos2 + read_length2 - sam_pos2; else sam_cross = seqio[seqi].pos2 - sam_pos2 - read_length1; seqio[seqi].seq1 = seqio[seqi].read_seq1; for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length2] = '\0'; seqio[seqi].seq2 = read_rev_buffer[seqi]; } else //1+ 2+ { seqio[seqi].flag1 = 65; seqio[seqi].flag2 = 129; //xa_d1s[tid][xa_i_1 + tra_i_n] = '-'; sam_cross = seqio[seqi].pos2 - sam_pos2; seqio[seqi].seq1 = seqio[seqi].read_seq1; seqio[seqi].seq2 = seqio[seqi].read_seq2; //strrev1(qual2_buffer[seqi]); } } else { if(op_rc_tmp == 1) //1- 2- { seqio[seqi].flag1 = 113; seqio[seqi].flag2 = 177; //xa_d1s[tid][xa_i_1 + tra_i_n] = '+'; sam_cross = seqio[seqi].pos2 - sam_pos2; for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length1] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer_1[seqi], sam_seq1); read_rev_buffer_1[seqi][read_length2] = '\0'; seqio[seqi].seq2 = read_rev_buffer_1[seqi]; //strrev1(qual1_buffer[seqi]); } else //1- 2+ { seqio[seqi].flag1 = 81; seqio[seqi].flag2 = 161; //xa_d1s[tid][xa_i_1 + tra_i_n] = '-'; if(sam_pos2 > seqio[seqi].pos2) sam_cross = seqio[seqi].pos2 - read_length1 - sam_pos2; else sam_cross = seqio[seqi].pos2 + read_length2 - sam_pos2; for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length1] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; seqio[seqi].seq2 = seqio[seqi].read_seq2; } } seqio[seqi].cross = sam_cross; strcpy(cigar_p1s[tid][xa_i_1 + tra_i_n], pr_cigar1_buffer[seqi]); strcpy(pr_cigar1_buffer[seqi], cigar_p2); } else { sam_pos1s[tid][xa_i_1 + tra_i_n] = (uint32_t )sam_pos2; lv_re1s[tid][xa_i_1 + tra_i_n] = dms1[tid][tra_i]; strcpy(cigar_p1s[tid][xa_i_1 + tra_i_n], cigar_p2); } tra_i_n++; } seqio[seqi].chr_res_s1 = chr_res_buffer1[seqi]; seqio[seqi].xa_n_x1 = tra_i_n; //xa_i_1 += seqio[seqi].xa_n_x1; xa_i_1 += tra_i_n; } else { for(tra_i = tra2_i; (tra_i_n < 1) && (tra_i < anchor_n2) && ((xa_i_2 + tra_i_n) < CUS_MAX_OUTPUT_ALI2); tra_i++) { if(orders2[tid][tra_i] >= MAX_REDUCE_ANCHOR_NUM) { v_cnt_i_tmp = orders2[tid][tra_i] - MAX_REDUCE_ANCHOR_NUM; if(ops_mask[v_cnt_i_tmp] == 1) continue; op_vector_seq1_tmp = ops_vector_seq1[tid][v_cnt_i_tmp]; } else { v_cnt_i_tmp = orders2[tid][tra_i]; if(op_mask[v_cnt_i_tmp] == 1) continue; op_vector_seq1_tmp = op_vector_seq1[tid][v_cnt_i_tmp]; } sam_pos2 = poses2[tid][tra_i]; x = sam_pos2; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos2 = x - chr_end_n[chr_re - 1] + 1; rcs = rcs2[tid][tra_i]; rs = rs2[tid][tra_i]; ls = ls2[tid][tra_i]; chr_res_buffer2[seqi][tra_i_n] = chr_re; if(rcs == 1) { xa_d2s[tid][xa_i_2 + tra_i_n] = '-'; #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][1]; read_bit_2[tid] = read_bit1[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); //strcpy(sam_seq2, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][1]; qual_filt_lv_1_o = qual_filt_lv2[tid][0]; #endif //cigar_m_1 = cigar_m2[tid]; //cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; //read_length_1 = read_length2; //read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_reverse; pound_pos_1_r = pound_pos2_r_reverse; pound_pos_2_f = pound_pos1_f_forward; pound_pos_2_r = pound_pos1_r_forward; } else { xa_d2s[tid][xa_i_2 + tra_i_n] = '+'; #ifdef CHAR_CP read_bit_1[tid] = read_bit2[tid][0]; read_bit_2[tid] = read_bit1[tid][1]; #else strcpy(sam_seq1, seqio[seqi].read_seq2); /* for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); */ #endif #ifdef QUAL_FILT_SINGLE_OUT qual_filt_lv_1 = qual_filt_lv2[tid][0]; qual_filt_lv_1_o = qual_filt_lv2[tid][1]; #endif //cigar_m_1 = cigar_m2[tid]; //cigar_m_2 = cigar_m1[tid]; lv_k_1 = lv_k2; lv_k_2 = lv_k1; //read_length_1 = read_length2; //read_length_2 = read_length1; pound_pos_1_f = pound_pos2_f_forward; pound_pos_1_r = pound_pos2_r_forward; pound_pos_2_f = pound_pos1_f_reverse; pound_pos_2_r = pound_pos1_r_reverse; } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_r_o_l = ls; s_r_o_r = rs; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m2[tid]); } else //indel { #ifdef OUTPUT_DEBUG if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length2 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length2; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length2 - s_r_o_l - 1; } else//4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_SINGLE_OUT for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length2 - 1- lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k_1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1_tmp[bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k_1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); if(str_o[s_o - 1] == 'S') f_cigar[f_cigarn - f_c - 1] = 'S'; else f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length2) { sn = sprintf(cigar_p2 + snt, "%uH", read_length2 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p2[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif #ifdef CIGAR_LEN_ERR #ifdef FIX_SA sv_s_len = 0; #endif cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; #ifdef FIX_SA if(cigar_p2[s_o_tmp - 1] == 'S') sv_s_len += cigar_len_tmp; #endif } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length2 != cigar_len) { if(read_length2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m2[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos2 = sam_pos2 + i_n1 - d_n1 + s_offset1; if(sam_pos2 == seqio[seqi].pos2) continue; if(sam_pos2 <= 0) sam_pos2 = 1; if(sv_s_len_p > sv_s_len) { chr_res_buffer2[seqi][tra_i_n] = seqio[seqi].chr_re2; seqio[seqi].chr_re2 = chr_re; sam_pos2s[tid][xa_i_2 + tra_i_n] = seqio[seqi].pos2; if((sam_pos2 + read_length2 - 1) > (chr_end_n[chr_re] - chr_end_n[chr_re - 1])) sam_pos2 = chr_end_n[chr_re] - chr_end_n[chr_re - 1] - 1 - read_length2; seqio[seqi].pos2 = sam_pos2; lv_re2s[tid][xa_i_2 + tra_i_n] = seqio[seqi].nm2; seqio[seqi].nm2 = dms2[tid][tra_i]; if(seqio[seqi].flag2 & 0X10) xa_d2s[tid][xa_i_1 + tra_i_n] = '-'; else xa_d2s[tid][xa_i_1 + tra_i_n] = '+'; if(op_rc_tmp == 0) { if(rcs == 1) //1+ 2- { seqio[seqi].flag1 = 97; seqio[seqi].flag2 = 145; //xa_d2s[tid][xa_i_2 + tra_i_n] = '-'; if(sam_pos2 > seqio[seqi].pos1) sam_cross = sam_pos2 + read_length2 - seqio[seqi].pos1; else sam_cross = sam_pos2 - seqio[seqi].pos1 - read_length1 ; seqio[seqi].seq1 = seqio[seqi].read_seq1; for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length2] = '\0'; seqio[seqi].seq2 = read_rev_buffer[seqi]; } else //1+ 2+ { seqio[seqi].flag1 = 65; seqio[seqi].flag2 = 129; //xa_d2s[tid][xa_i_2 + tra_i_n] = '+'; sam_cross = sam_pos2 - seqio[seqi].pos1; seqio[seqi].seq1 = seqio[seqi].read_seq1; seqio[seqi].seq2 = seqio[seqi].read_seq2; } } else { if(rcs == 1) //1- 2- { seqio[seqi].flag1 = 113; seqio[seqi].flag2 = 177; //xa_d2s[tid][xa_i_2 + tra_i_n] = '-'; sam_cross = sam_pos2 - seqio[seqi].pos1; for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length1] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer_1[seqi], sam_seq1); read_rev_buffer_1[seqi][read_length2] = '\0'; seqio[seqi].seq2 = read_rev_buffer_1[seqi]; } else //1- 2+ { seqio[seqi].flag1 = 81; seqio[seqi].flag2 = 161; //xa_d2s[tid][xa_i_2 + tra_i_n] = '+'; if(seqio[seqi].pos1 > sam_pos2) sam_cross = sam_pos2 - read_length1 - seqio[seqi].pos1; else sam_cross = sam_pos2 + read_length2 - seqio[seqi].pos1; for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length1] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; seqio[seqi].seq2 = seqio[seqi].read_seq2; } } seqio[seqi].cross = sam_cross; strcpy(cigar_p2s[tid][xa_i_2 + tra_i_n], pr_cigar2_buffer[seqi]); strcpy(pr_cigar2_buffer[seqi], cigar_p2); } else { sam_pos2s[tid][xa_i_2 + tra_i_n] = (uint32_t )sam_pos2; lv_re2s[tid][xa_i_2 + tra_i_n] = dms2[tid][tra_i]; strcpy(cigar_p2s[tid][xa_i_2 + tra_i_n], cigar_p2); } tra_i_n++; } seqio[seqi].chr_res_s2 = chr_res_buffer2[seqi]; seqio[seqi].xa_n_x2 = tra_i_n; //xa_i_2 += seqio[seqi].xa_n_x2; xa_i_2 += tra_i_n; } if(xa_i_1 > 0) { memcpy(xa_d1s_buffer[seqi], xa_d1s[tid], xa_i_1); seqio[seqi].xa_d1s = xa_d1s_buffer[seqi]; memcpy(sam_pos1s_buffer[seqi], sam_pos1s[tid], xa_i_1 << 2); seqio[seqi].sam_pos1s = sam_pos1s_buffer[seqi]; memcpy(lv_re1s_buffer[seqi], lv_re1s[tid], xa_i_1 << 2); seqio[seqi].lv_re1s = lv_re1s_buffer[seqi]; for(v_cnt_i = 0; v_cnt_i < xa_i_1; v_cnt_i++) { pos_l = strlen(cigar_p1s[tid][v_cnt_i]) + 1; seqio[seqi].cigar_p1s[v_cnt_i] = (char* )malloc(pos_l); memcpy(seqio[seqi].cigar_p1s[v_cnt_i], cigar_p1s[tid][v_cnt_i], pos_l); } } if(xa_i_2 > 0) { //memcpy(chr_res_buffer[seqi], chr_res[tid], xa_i_2 << 2); //seqio[seqi].chr_res = chr_res_buffer[seqi]; memcpy(xa_d2s_buffer[seqi], xa_d2s[tid], xa_i_2); seqio[seqi].xa_d2s = xa_d2s_buffer[seqi]; memcpy(sam_pos2s_buffer[seqi], sam_pos2s[tid], xa_i_2 << 2); seqio[seqi].sam_pos2s = sam_pos2s_buffer[seqi]; memcpy(lv_re2s_buffer[seqi], lv_re2s[tid], xa_i_2 << 2); seqio[seqi].lv_re2s = lv_re2s_buffer[seqi]; for(v_cnt_i = 0; v_cnt_i < xa_i_2; v_cnt_i++) { pos_l = strlen(cigar_p2s[tid][v_cnt_i]) + 1; seqio[seqi].cigar_p2s[v_cnt_i] = (char* )malloc(pos_l); memcpy(seqio[seqi].cigar_p2s[v_cnt_i], cigar_p2s[tid][v_cnt_i], pos_l); } } #else if(xa_i_1 > 0) { memcpy(xa_d1s_buffer[seqi], xa_d1s[tid], xa_i_1); seqio[seqi].xa_d1s = xa_d1s_buffer[seqi]; memcpy(sam_pos1s_buffer[seqi], sam_pos1s[tid], xa_i_1 << 2); seqio[seqi].sam_pos1s = sam_pos1s_buffer[seqi]; memcpy(lv_re1s_buffer[seqi], lv_re1s[tid], xa_i_1 << 2); seqio[seqi].lv_re1s = lv_re1s_buffer[seqi]; for(v_cnt_i = 0; v_cnt_i < xa_i_1; v_cnt_i++) { pos_l = strlen(cigar_p1s[tid][v_cnt_i]) + 1; seqio[seqi].cigar_p1s[v_cnt_i] = (char* )malloc(pos_l); memcpy(seqio[seqi].cigar_p1s[v_cnt_i], cigar_p1s[tid][v_cnt_i], pos_l); } } if(xa_i_2 > 0) { //memcpy(chr_res_buffer[seqi], chr_res[tid], xa_i_2 << 2); //seqio[seqi].chr_res = chr_res_buffer[seqi]; memcpy(xa_d2s_buffer[seqi], xa_d2s[tid], xa_i_2); seqio[seqi].xa_d2s = xa_d2s_buffer[seqi]; memcpy(sam_pos2s_buffer[seqi], sam_pos2s[tid], xa_i_2 << 2); seqio[seqi].sam_pos2s = sam_pos2s_buffer[seqi]; memcpy(lv_re2s_buffer[seqi], lv_re2s[tid], xa_i_2 << 2); seqio[seqi].lv_re2s = lv_re2s_buffer[seqi]; for(v_cnt_i = 0; v_cnt_i < xa_i_2; v_cnt_i++) { pos_l = strlen(cigar_p2s[tid][v_cnt_i]) + 1; seqio[seqi].cigar_p2s[v_cnt_i] = (char* )malloc(pos_l); memcpy(seqio[seqi].cigar_p2s[v_cnt_i], cigar_p2s[tid][v_cnt_i], pos_l); } } #endif } else { //seqio[seqi].xa_n = 0; seqio[seqi].xa_n_p1 = 0; seqio[seqi].xa_n_p2 = 0; #ifdef FIX_SV seqio[seqi].xa_n_x1 = 0; seqio[seqi].xa_n_x2 = 0; #endif seqio[seqi].xa_n1 = 0; seqio[seqi].xa_n2 = 0; seqio[seqi].flag1 = 77; seqio[seqi].flag2 = 141; //seqio[seqi].chr_re = chr_file_n; seqio[seqi].chr_re1 = chr_file_n; seqio[seqi].chr_re2 = chr_file_n; seqio[seqi].pos1 = 0; seqio[seqi].pos2 = 0; seqio[seqi].qualc1 = 0; seqio[seqi].qualc2 = 0; strcpy(pr_cigar1_buffer[seqi], "*"); seqio[seqi].cigar1 = pr_cigar1_buffer[seqi]; strcpy(pr_cigar2_buffer[seqi], "*"); seqio[seqi].cigar2 = pr_cigar2_buffer[seqi]; seqio[seqi].seq1 = seqio[seqi].read_seq1; seqio[seqi].seq2 = seqio[seqi].read_seq2; } } #else seqio[seqi].v_cnt = 0; #endif } return 0; } #ifdef UNPIPATH_OFF_K20 seed_pa_single* single_seed_reduction_core_single64(seed_pa_single* seedpa, uint64_t* read_bit, uint8_t* read_val, uint64_t** seed_set_pos, uint8_t tid, uint16_t read_length, uint16_t* max_seed_length, uint8_t rc_i) #else seed_pa_single* single_seed_reduction_core_single(seed_pa_single* seedpa, uint64_t* read_bit, uint8_t* read_val, uint32_t** seed_set_pos, uint8_t tid, uint16_t read_length, uint16_t* max_seed_length, uint8_t rc_i) #endif { #ifdef UNPIPATH_OFF_K20 uint64_t kmer_pos_uni = 0; uint64_t* pos_tmp_p = NULL; #else uint32_t kmer_pos_uni = 0; uint32_t* pos_tmp_p = NULL; #endif uint8_t pop_i = 0; uint8_t re_d = 0; uint8_t b_t_n_r = 0; uint16_t left_i = 1; uint16_t right_i = 1; uint16_t read_off = 0; uint16_t read_pos = 0; uint16_t length = 0; uint16_t rt_pos = 0; uint16_t mem_i = 0; uint16_t r_b_v = 0; uint16_t su_i = 0; uint16_t seed_set_i = 0; uint16_t cov_i = 0; uint32_t seed_i = 0; uint32_t uni_offset_s_l = 0; uint32_t uni_offset_s_r = 0; uint32_t ref_pos_n = 0; uint32_t uni_id = 0; uint32_t seed_hash = 0; uint32_t seed_kmer = 0; uint32_t uni_id_tmp = 0Xffffffff; uint32_t spa_i = 0; uint32_t pos_n = 0; uint32_t set_n = 0; uint32_t b_p_i = 0; uint32_t id_i = 0; uint32_t off_n = 0; uint32_t off_i = 0; uint32_t set_pos_n = 0; uint32_t pos_start_off = 0; uint32_t set_i = 0; uint32_t set_i_pre = 0; uint32_t seed_same_n = 0; uint32_t max_sets_n = 0; uint32_t interval_n = 0; uint32_t bn = 0; uint32_t sn = 0; int r_p1 = 0; int set_c_r = 0; uint64_t kmer_bit = 0; int64_t posp = 0; int64_t reduce_pn = 0; int64_t reduce_p = 0; int64_t reduce_sn = 0; int64_t reduce_s = 0; int64_t b_r_s = 0; int64_t seed_binary_r = 0; int64_t seed_id_r = 0; int64_t ref_off1 = 0; seed_m* seed_tmp = NULL; #ifdef SINGLE_PAIR uint16_t cov_num_front = 0; uint16_t cov_num_re = 0; uint16_t length_front = 0; uint16_t length_back = 0; #endif mem_i = 0; r_b_v = 0; for(read_off = 0; read_off <= read_length - k_t; read_off += seed_l[tid]) { if(read_off + k_t - 1 <= r_b_v) continue; re_d = (read_off & 0X1f); b_t_n_r = 32 - re_d; #ifdef HASH_KMER_READ_J if(re_d <= re_b) { kmer_bit = ((read_bit[read_off >> 5] & bit_tran_re[re_d]) >> ((re_b - re_d) << 1)); } else { kmer_bit = (((read_bit[read_off >> 5] & bit_tran_re[re_d]) << ((re_d - re_b) << 1)) | (read_bit[(read_off >> 5) + 1] >> ((re_2bt - re_d) << 1))); } #else tran_tmp_p = (read_bit[read_off >> 5] & bit_tran_re[re_d]); //or use this method to deal with: & bit_tran_re[b_t_n_r] kmer_bit = (((read_bit[(read_off >> 5) + 1] >> (b_t_n_r << 1)) & bit_tran_re[b_t_n_r]) | (tran_tmp_p << (re_d << 1))); kmer_bit >>= re_bt; #endif seed_kmer = (kmer_bit & bit_tran[k_r]); seed_hash = (kmer_bit >> (k_r << 1)); //find the kmer #ifdef UNPIPATH_OFF_K20 seed_binary_r = binsearch_offset64(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #else seed_binary_r = binsearch_offset(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #endif if(seed_binary_r == -1) continue; //binary search on unipath offset to get the unipathID kmer_pos_uni = buffer_off_g[seed_binary_r];//this kmer's offset on unipath #ifdef UNPIPATH_OFF_K20 seed_id_r = binsearch_interval_unipath64(kmer_pos_uni, buffer_seqf, result_seqf); #else seed_id_r = binsearch_interval_unipath(kmer_pos_uni, buffer_seqf, result_seqf); #endif ref_pos_n = buffer_pp[seed_id_r + 1] - buffer_pp[seed_id_r]; if(ref_pos_n > pos_n_max) { continue; } uni_offset_s_l = kmer_pos_uni - buffer_seqf[seed_id_r]; uni_offset_s_r = buffer_seqf[seed_id_r + 1] - (kmer_pos_uni + k_t); for(left_i = 1; (left_i <= uni_offset_s_l) && (left_i <= read_off); left_i++) { #ifdef UNI_SEQ64 if(((buffer_seq[(kmer_pos_uni - left_i) >> 5] >> ((31 - ((kmer_pos_uni - left_i) & 0X1f)) << 1)) & 0X3) != ((read_bit[(read_off - left_i) >> 5] >> ((31 - ((read_off - left_i) & 0X1f)) << 1)) & 0X3) ) break; #else if(((buffer_seq[(kmer_pos_uni - left_i) >> 2] >> (((kmer_pos_uni - left_i) & 0X3) << 1)) & 0X3) != ((read_bit[(read_off - left_i) >> 5] >> ((31 - ((read_off - left_i) & 0X1f)) << 1)) & 0X3) ) break; #endif } for(right_i = 1; (right_i <= uni_offset_s_r) && (right_i <= read_length - read_off - k_t); right_i++) { #ifdef UNI_SEQ64 if(((buffer_seq[(kmer_pos_uni + k_t - 1 + right_i) >> 5] >> ((31 - ((kmer_pos_uni + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) != ((read_bit[(read_off + k_t - 1 + right_i) >> 5] >> ((31 - ((read_off + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) ) break; #else if(((buffer_seq[(kmer_pos_uni + k_t - 1 + right_i) >> 2] >> (((kmer_pos_uni + k_t - 1 + right_i) & 0X3) << 1)) & 0X3) != ((read_bit[(read_off + k_t - 1 + right_i) >> 5] >> ((31 - ((read_off + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) ) break; #endif } read_pos = read_off + 1 - left_i; length = k_t + left_i + right_i - 2; rt_pos = read_off + k_t + right_i - 2; seedm[tid][mem_i].uni_id = seed_id_r; seedm[tid][mem_i].length = length; seedm[tid][mem_i].read_pos = read_pos; seedm[tid][mem_i].ref_pos_off = uni_offset_s_l + 1 - left_i; seedm[tid][mem_i].ref_pos_n = ref_pos_n; if((left_i - 1 < read_off) || (right_i - 1 < read_length - read_off - k_t)) { seedm[tid][mem_i].ui = 0; } else { seedm[tid][mem_i].ui = 1; seedm[tid][mem_i].ref_pos_off_r = uni_offset_s_r + 1 - right_i; } seedm[tid][mem_i].s_r_o_l = read_off - left_i; seedm[tid][mem_i].s_r_o_r = read_off + k_t + right_i - 1; memset(seedm[tid][mem_i].cov, 0Xff, (cov_a_n_s[tid]) << 3); (seedm[tid][mem_i].cov)[read_pos >> 6] = bv_64[(64 - (read_pos & 0X3f))]; (seedm[tid][mem_i].cov)[rt_pos >> 6] ^= bv_64[(63 - (rt_pos & 0X3f))]; for(cov_i = (read_pos >> 6); cov_i > 0; cov_i--) (seedm[tid][mem_i].cov)[cov_i - 1] = 0; for(cov_i = (rt_pos >> 6) + 1; cov_i < cov_a_n_s[tid]; cov_i++) (seedm[tid][mem_i].cov)[cov_i] = 0; seedm[tid][mem_i].tid = tid; r_b_v = read_off + k_t + right_i - 1; ++mem_i; } //end MEM if(mem_i == 0) return 0; //merge seeds in the same unipath s_uid_f[tid] = 0; qsort(seedm[tid], mem_i, sizeof(seed_m), compare_uniid); if(s_uid_f[tid] == 1) { su_i = 0; for(seed_i = 0; seed_i < mem_i; seed_i++) { if(uni_id_tmp != seedm[tid][seed_i].uni_id) { seedu[tid][su_i].uni_id = seedm[tid][seed_i].uni_id; seedu[tid][su_i].read_pos = seedm[tid][seed_i].read_pos; seedu[tid][su_i].ref_pos_off = seedm[tid][seed_i].ref_pos_off; seedu[tid][su_i].ref_pos_off_r = seedm[tid][seed_i].ref_pos_off_r; seedu[tid][su_i].ui = seedm[tid][seed_i].ui; seedu[tid][su_i].s_r_o_l = seedm[tid][seed_i].s_r_o_l; seedu[tid][su_i].s_r_o_r = seedm[tid][seed_i].s_r_o_r; seedu[tid][su_i].ref_pos_n = seedm[tid][seed_i].ref_pos_n; memcpy(seedu[tid][su_i].cov, seedm[tid][seed_i].cov, (cov_a_n_s[tid]) << 3); seedu[tid][su_i].tid = tid; //cal length if(su_i > 0) { seedu[tid][su_i - 1].length = 0; for(cov_i = 0; cov_i < cov_a_n_s[tid]; cov_i++) seedu[tid][su_i - 1].length += popcount_3((seedu[tid][su_i - 1].cov)[cov_i]); } ++su_i; } else { for(cov_i = 0; cov_i < cov_a_n_s[tid]; cov_i++) (seedu[tid][su_i - 1].cov)[cov_i] |= (seedm[tid][seed_i].cov)[cov_i]; } uni_id_tmp = seedm[tid][seed_i].uni_id; } seedu[tid][su_i - 1].length = 0; for(cov_i = 0; cov_i < cov_a_n_s[tid]; cov_i++) seedu[tid][su_i - 1].length += popcount_3((seedu[tid][su_i - 1].cov)[cov_i]); //end merge of same unipath seed_tmp = seedu[tid]; } else { su_i = mem_i; seed_tmp = seedm[tid]; } //add print for ( seed_i = 0; seed_i < su_i; ++seed_i) { fprintf(stderr, "read_pos = %u, length = %u\n", seedu[tid][seed_i].read_pos, seedu[tid][seed_i].length); } //uniqueness qsort(seed_tmp, su_i, sizeof(seed_m), compare_posn); uni_id = seed_tmp[0].uni_id; ref_off1 = seed_tmp[0].ref_pos_off; r_p1 = seed_tmp[0].read_pos; pos_tmp_p = buffer_p + buffer_pp[uni_id]; pos_n = buffer_pp[uni_id + 1] - buffer_pp[uni_id]; //fingerprint for(id_i = 0; id_i < pos_n; id_i++) { seedsets[tid][id_i].seed_set = pos_tmp_p[id_i] + ref_off1 - r_p1; memcpy(seedsets[tid][id_i].cov, seed_tmp[0].cov, (cov_a_n_s[tid]) << 3); seedsets[tid][id_i].ui = seed_tmp[0].ui; seedsets[tid][id_i].ref_pos_off = ref_off1; seedsets[tid][id_i].ref_pos_off_r = seed_tmp[0].ref_pos_off_r; seedsets[tid][id_i].s_r_o_l = seed_tmp[0].s_r_o_l; seedsets[tid][id_i].s_r_o_r = seed_tmp[0].s_r_o_r; seedsets[tid][id_i].tid = tid; } set_n += pos_n; seed_set_off[tid][0] = 0; seed_set_off[tid][1] = pos_n; off_n += 2; #ifdef MERGE_B_R_VS for(seed_i = 1; seed_i < su_i; seed_i++) { uni_id = seed_tmp[seed_i].uni_id; ref_off1 = seed_tmp[seed_i].ref_pos_off; r_p1 = seed_tmp[seed_i].read_pos; reduce_pn = buffer_pp[uni_id + 1]; bn = reduce_pn - buffer_pp[uni_id]; for(seed_set_i = 0; seed_set_i < seed_i; seed_set_i++) { reduce_sn = seed_set_off[tid][seed_set_i + 1]; sn = reduce_sn - seed_set_off[tid][seed_set_i]; if(bn <= sn) { reduce_s = seed_set_off[tid][seed_set_i]; for(b_p_i = buffer_pp[uni_id]; b_p_i < reduce_pn; b_p_i++) { posp = buffer_p[b_p_i] + ref_off1 - r_p1; #ifdef UNPIPATH_OFF_K20 b_r_s = binsearch_seed_set_reduce64(posp, seedsets[tid], reduce_sn - reduce_s, reduce_s, tid); #else b_r_s = binsearch_seed_set_reduce(posp, seedsets[tid], reduce_sn - reduce_s, reduce_s, tid); #endif if(b_r_s != -1) { for(cov_i = 0; cov_i < cov_a_n_s[tid]; cov_i++) (seedsets[tid][b_r_s].cov)[cov_i] |= (seed_tmp[seed_i].cov)[cov_i]; pos_add[tid][b_p_i - buffer_pp[uni_id]] = 1; if(b_r_s == reduce_sn - 1) break; reduce_s = b_r_s + 1; } else { if(g_low[tid] == reduce_sn - reduce_s) break; else reduce_s += g_low[tid]; } } } else { reduce_p = buffer_pp[uni_id]; for(b_p_i = seed_set_off[tid][seed_set_i]; b_p_i < reduce_sn; b_p_i++) { posp = seedsets[tid][b_p_i].seed_set + r_p1 - ref_off1; #ifdef UNPIPATH_OFF_K20 b_r_s = binsearch_seed_pos_reduce64(posp, buffer_p, reduce_pn - reduce_p, reduce_p, tid); #else b_r_s = binsearch_seed_pos_reduce(posp, buffer_p, reduce_pn - reduce_p, reduce_p, tid); #endif if(b_r_s != -1) { for(cov_i = 0; cov_i < cov_a_n_s[tid]; cov_i++) (seedsets[tid][b_p_i].cov)[cov_i] |= (seed_tmp[seed_i].cov)[cov_i]; pos_add[tid][b_r_s - buffer_pp[uni_id]] = 1; if(b_r_s == reduce_pn - 1) break; reduce_p = b_r_s + 1; } else { if(g_low[tid] == reduce_pn - reduce_p) break; else reduce_p += g_low[tid]; } } } } for(b_p_i = 0; b_p_i < bn; b_p_i++) { if(pos_add[tid][b_p_i] == 0) { seedsets[tid][set_n].seed_set = buffer_p[buffer_pp[uni_id] + b_p_i] + ref_off1 - r_p1; memcpy(seedsets[tid][set_n].cov, seed_tmp[seed_i].cov, (cov_a_n_s[tid]) << 3); seedsets[tid][set_n].ui = seed_tmp[seed_i].ui; seedsets[tid][set_n].ref_pos_off = ref_off1; seedsets[tid][set_n].ref_pos_off_r = seed_tmp[seed_i].ref_pos_off_r; seedsets[tid][set_n].s_r_o_l = seed_tmp[seed_i].s_r_o_l; seedsets[tid][set_n].s_r_o_r = seed_tmp[seed_i].s_r_o_r; seedsets[tid][set_n].tid = tid; ++set_n; } } memset(pos_add[tid], 0, bn); seed_set_off[tid][seed_i + 1] = set_n; ++off_n; } #endif #ifdef SINGLE_PAIR cov_num_front = cov_num_front_single[tid]; cov_num_re = cov_num_re_single[tid]; #endif spa_i = spa_i_single[tid]; set_pos_n = set_pos_n_single[tid]; pos_start_off = set_pos_n_single[tid]; for(off_i = 0; off_i < off_n - 1; off_i++) { interval_n = seed_set_off[tid][off_i + 1] - seed_set_off[tid][off_i]; if(interval_n == 0) continue; qsort(seedsets[tid] + seed_set_off[tid][off_i], interval_n, sizeof(seed_sets), compare_sets_s); //copy elements from seed_tmp[off_i] as for other elements such as quality set_i_pre = seed_set_off[tid][off_i]; seedpa[spa_i].rc = rc_i; seedpa[spa_i].pos_start = set_i_pre + pos_start_off; memcpy(seedpa[spa_i].cov, seedsets[tid][set_i_pre].cov, (cov_a_n_s[tid]) << 3); seedpa[spa_i].ref_pos_off = seedsets[tid][set_i_pre].ref_pos_off; seedpa[spa_i].ref_pos_off_r = seedsets[tid][set_i_pre].ref_pos_off_r; seedpa[spa_i].ui = seedsets[tid][set_i_pre].ui; seedpa[spa_i].s_r_o_l = seedsets[tid][set_i_pre].s_r_o_l; seedpa[spa_i].s_r_o_r = seedsets[tid][set_i_pre].s_r_o_r; #ifdef SINGLE_PAIR length_front = 0; length_back = 0; for(pop_i = 0; pop_i < cov_num_front; pop_i++) length_front += popcount_3((seedpa[spa_i].cov)[pop_i]); length_front += popcount_3(((seedpa[spa_i].cov)[cov_num_front]) >> cov_num_re); length_back += popcount_3(((seedpa[spa_i].cov)[cov_num_front]) & bv_64[cov_num_re]); for(pop_i = cov_num_front + 1; pop_i < cov_a_n_s[tid]; pop_i++) length_back += popcount_3((seedpa[spa_i].cov)[pop_i]); seedpa[spa_i].length = length_front + length_back; if(seedpa[spa_i].length > max_sets_n) max_sets_n = seedpa[spa_i].length; if((length_front > k_t) && (length_back > k_t)) seedpa[spa_i].pair_flag = 1; else seedpa[spa_i].pair_flag = 0; #else //cal number of 1 (length) seedpa[spa_i].length = 0; for(pop_i = 0; pop_i < cov_a_n_s[tid]; pop_i++) seedpa[spa_i].length += popcount_3((seedpa[spa_i].cov)[pop_i]); if(seedpa[spa_i].length > max_sets_n) max_sets_n = seedpa[spa_i].length; #endif ++spa_i; seed_same_n = 1; //copy pos to seed_set_pos (*seed_set_pos)[set_pos_n++] = seedsets[tid][set_i_pre].seed_set; //+ ref_off - r_p for(set_i = set_i_pre + 1; set_i < seed_set_off[tid][off_i + 1]; set_i++) { set_c_r = memcmp(seedsets[tid][set_i_pre].cov, seedsets[tid][set_i].cov, (cov_a_n_s[tid]) << 3); if(set_c_r != 0) { seedpa[spa_i - 1].pos_n = seed_same_n; //copy elements from seed_tmp[off_i] as for other elements such as quality seedpa[spa_i].rc = rc_i; seedpa[spa_i].pos_start = set_i + pos_start_off; memcpy(seedpa[spa_i].cov, seedsets[tid][set_i].cov, (cov_a_n_s[tid]) << 3); seedpa[spa_i].ref_pos_off = seedsets[tid][set_i].ref_pos_off; seedpa[spa_i].ref_pos_off_r = seedsets[tid][set_i].ref_pos_off_r; seedpa[spa_i].ui = seedsets[tid][set_i].ui; seedpa[spa_i].s_r_o_l = seedsets[tid][set_i].s_r_o_l; seedpa[spa_i].s_r_o_r = seedsets[tid][set_i].s_r_o_r; #ifdef SINGLE_PAIR length_front = 0; length_back = 0; for(pop_i = 0; pop_i < cov_num_front; pop_i++) length_front += popcount_3((seedpa[spa_i].cov)[pop_i]); length_front += popcount_3(((seedpa[spa_i].cov)[cov_num_front]) >> cov_num_re); length_back += popcount_3(((seedpa[spa_i].cov)[cov_num_front]) & bv_64[cov_num_re]); for(pop_i = cov_num_front + 1; pop_i < cov_a_n_s[tid]; pop_i++) length_back += popcount_3((seedpa[spa_i].cov)[pop_i]); seedpa[spa_i].length = length_front + length_back; if(seedpa[spa_i].length > max_sets_n) max_sets_n = seedpa[spa_i].length; if((length_front > k_t) && (length_back > k_t)) seedpa[spa_i].pair_flag = 1; else seedpa[spa_i].pair_flag = 0; #else //cal number of 1 (length) seedpa[spa_i].length = 0; for(pop_i = 0; pop_i < cov_a_n_s[tid]; pop_i++) seedpa[spa_i].length += popcount_3((seedpa[spa_i].cov)[pop_i]); if(seedpa[spa_i].length > max_sets_n) max_sets_n = seedpa[spa_i].length; #endif ++spa_i; seed_same_n = 1; } else ++seed_same_n; //copy pos to seed_set_pos (*seed_set_pos)[set_pos_n++] = seedsets[tid][set_i].seed_set;// + ref_off - r_p set_i_pre = set_i; } seedpa[spa_i - 1].pos_n = seed_same_n; } set_pos_n_single[tid] = set_pos_n; //qsort(seedpa, spa_i, sizeof(seed_pa), compare_plen); spa_i_single[tid] = spa_i; (*max_seed_length) = max_sets_n; return seedpa; } #ifdef UNPIPATH_OFF_K20 seed_pa* single_seed_reduction_core_filter64(seed_pa* seedpa, uint64_t* read_bit, uint8_t* read_val, uint32_t* spa1_i, uint64_t** seed_set_pos, uint16_t* pos_ren, uint8_t tid, uint16_t read_length, uint16_t* seed_num, uint16_t* max_seed_length) #else seed_pa* single_seed_reduction_core_filter(seed_pa* seedpa, uint64_t* read_bit, uint8_t* read_val, uint32_t* spa1_i, uint32_t** seed_set_pos, uint16_t* pos_ren, uint8_t tid, uint16_t read_length, uint16_t* seed_num, uint16_t* max_seed_length) #endif { uint8_t pop_i = 0; uint8_t re_d = 0; uint8_t b_t_n_r = 0; uint8_t cov_a_t = 0; uint16_t left_i = 1; uint16_t right_i = 1; uint16_t read_off = 0; uint16_t read_pos = 0; uint16_t length = 0; uint16_t rt_pos = 0; uint16_t mem_i = 0; uint16_t r_b_v = 0; uint16_t su_i = 0; uint16_t seed_set_i = 0; uint16_t cov_i = 0; uint32_t seed_i = 0; uint32_t uni_offset_s_l = 0; uint32_t uni_offset_s_r = 0; uint32_t ref_pos_n = 0; uint32_t seed_hash = 0; uint32_t seed_kmer = 0; uint32_t uni_id_tmp = 0Xffffffff; uint32_t spa_i = 0; uint32_t pos_n = 0; uint32_t set_n = 0; uint32_t id_i = 0; uint32_t off_n = 0; uint32_t off_i = 0; uint32_t set_pos_n = 0; uint32_t set_i = 0; uint32_t set_i_pre = 0; uint32_t seed_same_n = 0; uint32_t max_sets_n = 0; uint32_t interval_n = 0; uint32_t bn = 0; uint32_t sn = 0; #ifdef UNPIPATH_OFF_K20 uint64_t* pos_tmp_p = NULL; uint64_t kmer_pos_uni = 0; uint64_t b_p_i = 0; uint64_t uni_id = 0; #else uint32_t* pos_tmp_p = NULL; uint32_t kmer_pos_uni = 0; uint32_t b_p_i = 0; uint32_t uni_id = 0; #endif int r_p1 = 0; int set_c_r = 0; uint64_t kmer_bit = 0; int64_t posp = 0; int64_t reduce_pn = 0; int64_t reduce_p = 0; int64_t reduce_sn = 0; int64_t reduce_s = 0; int64_t b_r_s = 0; int64_t seed_binary_r = 0; int64_t seed_id_r = 0; int64_t ref_off1 = 0; cov_a_t = cov_a_n[tid][rc_cov_f[tid]]; seed_m* seed_tmp = NULL; mem_i = 0; r_b_v = 0; for(read_off = 0; read_off <= read_length - k_t; read_off += seed_l[tid]) { if(read_off + k_t - 1 <= r_b_v) continue; re_d = (read_off & 0X1f); b_t_n_r = 32 - re_d; #ifdef HASH_KMER_READ_J if(re_d <= re_b) { kmer_bit = ((read_bit[read_off >> 5] & bit_tran_re[re_d]) >> ((re_b - re_d) << 1)); } else { kmer_bit = (((read_bit[read_off >> 5] & bit_tran_re[re_d]) << ((re_d - re_b) << 1)) | (read_bit[(read_off >> 5) + 1] >> ((re_2bt - re_d) << 1))); } #else tran_tmp_p = (read_bit[read_off >> 5] & bit_tran_re[re_d]); //or use this method to deal with: & bit_tran_re[b_t_n_r] kmer_bit = (((read_bit[(read_off >> 5) + 1] >> (b_t_n_r << 1)) & bit_tran_re[b_t_n_r]) | (tran_tmp_p << (re_d << 1))); kmer_bit >>= re_bt; #endif seed_kmer = (kmer_bit & bit_tran[k_r]); seed_hash = (kmer_bit >> (k_r << 1)); //find the kmer #ifdef UNPIPATH_OFF_K20 seed_binary_r = binsearch_offset64(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #else seed_binary_r = binsearch_offset(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #endif if(seed_binary_r == -1) continue; //binary search on unipath offset to get the unipathID kmer_pos_uni = buffer_off_g[seed_binary_r];//this kmer's offset on unipath #ifdef UNPIPATH_OFF_K20 seed_id_r = binsearch_interval_unipath64(kmer_pos_uni, buffer_seqf, result_seqf); #else seed_id_r = binsearch_interval_unipath(kmer_pos_uni, buffer_seqf, result_seqf); #endif ref_pos_n = buffer_pp[seed_id_r + 1] - buffer_pp[seed_id_r]; if(ref_pos_n > pos_n_max) { #ifdef PAIR_RANDOM if(seed_l[tid] == pair_ran_intvp) (*pos_ren)++; #endif continue; } uni_offset_s_l = kmer_pos_uni - buffer_seqf[seed_id_r]; uni_offset_s_r = buffer_seqf[seed_id_r + 1] - (kmer_pos_uni + k_t); for(left_i = 1; (left_i <= uni_offset_s_l) && (left_i <= read_off); left_i++) { #ifdef UNI_SEQ64 if(((buffer_seq[(kmer_pos_uni - left_i) >> 5] >> ((31 - ((kmer_pos_uni - left_i) & 0X1f)) << 1)) & 0X3) != ((read_bit[(read_off - left_i) >> 5] >> ((31 - ((read_off - left_i) & 0X1f)) << 1)) & 0X3) ) break; #else if(((buffer_seq[(kmer_pos_uni - left_i) >> 2] >> (((kmer_pos_uni - left_i) & 0X3) << 1)) & 0X3) != ((read_bit[(read_off - left_i) >> 5] >> ((31 - ((read_off - left_i) & 0X1f)) << 1)) & 0X3) ) break; #endif } for(right_i = 1; (right_i <= uni_offset_s_r) && (right_i <= read_length - read_off - k_t); right_i++) { #ifdef UNI_SEQ64 if(((buffer_seq[(kmer_pos_uni + k_t - 1 + right_i) >> 5] >> ((31 - ((kmer_pos_uni + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) != ((read_bit[(read_off + k_t - 1 + right_i) >> 5] >> ((31 - ((read_off + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) ) break; #else if(((buffer_seq[(kmer_pos_uni + k_t - 1 + right_i) >> 2] >> (((kmer_pos_uni + k_t - 1 + right_i) & 0X3) << 1)) & 0X3) != ((read_bit[(read_off + k_t - 1 + right_i) >> 5] >> ((31 - ((read_off + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) ) break; #endif } read_pos = read_off + 1 - left_i; length = k_t + left_i + right_i - 2; rt_pos = read_off + k_t + right_i - 2; seedm[tid][mem_i].uni_id = seed_id_r; seedm[tid][mem_i].length = length; seedm[tid][mem_i].read_pos = read_pos; seedm[tid][mem_i].ref_pos_off = uni_offset_s_l + 1 - left_i; seedm[tid][mem_i].ref_pos_n = ref_pos_n; if((left_i - 1 < read_off) || (right_i - 1 < read_length - read_off - k_t)) //cross the unipath { seedm[tid][mem_i].ui = 0; } else { seedm[tid][mem_i].ui = 1; seedm[tid][mem_i].ref_pos_off_r = uni_offset_s_r + 1 - right_i; } seedm[tid][mem_i].s_r_o_l = read_off - left_i; seedm[tid][mem_i].s_r_o_r = read_off + k_t + right_i - 1; memset(seedm[tid][mem_i].cov, 0Xff, (cov_a_t) << 3); (seedm[tid][mem_i].cov)[read_pos >> 6] = bv_64[(64 - (read_pos & 0X3f))]; (seedm[tid][mem_i].cov)[rt_pos >> 6] ^= bv_64[(63 - (rt_pos & 0X3f))]; for(cov_i = (read_pos >> 6); cov_i > 0; cov_i--) (seedm[tid][mem_i].cov)[cov_i - 1] = 0; for(cov_i = (rt_pos >> 6) + 1; cov_i < cov_a_t; cov_i++) (seedm[tid][mem_i].cov)[cov_i] = 0; seedm[tid][mem_i].tid = tid; r_b_v = read_off + k_t + right_i - 1; ++mem_i; } //end MEM if(mem_i == 0) return 0; //merge seeds in the same unipath s_uid_f[tid] = 0; qsort(seedm[tid], mem_i, sizeof(seed_m), compare_uniid); if(s_uid_f[tid] == 1) { su_i = 0; for(seed_i = 0; seed_i < mem_i; seed_i++) { if(uni_id_tmp != seedm[tid][seed_i].uni_id) { seedu[tid][su_i].uni_id = seedm[tid][seed_i].uni_id; seedu[tid][su_i].read_pos = seedm[tid][seed_i].read_pos;//choose the one with more ref positions seedu[tid][su_i].ref_pos_off = seedm[tid][seed_i].ref_pos_off; seedu[tid][su_i].ref_pos_off_r = seedm[tid][seed_i].ref_pos_off_r; seedu[tid][su_i].ui = seedm[tid][seed_i].ui; seedu[tid][su_i].s_r_o_l = seedm[tid][seed_i].s_r_o_l; seedu[tid][su_i].s_r_o_r = seedm[tid][seed_i].s_r_o_r; seedu[tid][su_i].ref_pos_n = seedm[tid][seed_i].ref_pos_n; memcpy(seedu[tid][su_i].cov, seedm[tid][seed_i].cov, (cov_a_t) << 3); seedu[tid][su_i].tid = tid; //cal length if(su_i > 0) { seedu[tid][su_i - 1].length = 0; for(cov_i = 0; cov_i < cov_a_t; cov_i++) seedu[tid][su_i - 1].length += popcount_3((seedu[tid][su_i - 1].cov)[cov_i]); } ++su_i; } else { for(cov_i = 0; cov_i < cov_a_t; cov_i++) (seedu[tid][su_i - 1].cov)[cov_i] |= (seedm[tid][seed_i].cov)[cov_i]; } uni_id_tmp = seedm[tid][seed_i].uni_id; } seedu[tid][su_i - 1].length = 0; for(cov_i = 0; cov_i < cov_a_t; cov_i++) seedu[tid][su_i - 1].length += popcount_3((seedu[tid][su_i - 1].cov)[cov_i]); //end merge of same unipath seed_tmp = seedu[tid]; } else { su_i = mem_i; seed_tmp = seedm[tid]; } //uniqueness qsort(seed_tmp, su_i, sizeof(seed_m), compare_posn); uni_id = seed_tmp[0].uni_id; ref_off1 = seed_tmp[0].ref_pos_off; r_p1 = seed_tmp[0].read_pos; pos_tmp_p = buffer_p + buffer_pp[uni_id];//119843814 pos_n = buffer_pp[uni_id + 1] - buffer_pp[uni_id]; //fingerprint for(id_i = 0; id_i < pos_n; id_i++) { seedsets[tid][id_i].seed_set = pos_tmp_p[id_i] + ref_off1 - r_p1; memcpy(seedsets[tid][id_i].cov, seed_tmp[0].cov, (cov_a_t) << 3); seedsets[tid][id_i].ui = seed_tmp[0].ui; seedsets[tid][id_i].ref_pos_off = ref_off1; seedsets[tid][id_i].ref_pos_off_r = seed_tmp[0].ref_pos_off_r; seedsets[tid][id_i].s_r_o_l = seed_tmp[0].s_r_o_l; seedsets[tid][id_i].s_r_o_r = seed_tmp[0].s_r_o_r; seedsets[tid][id_i].tid = tid; } set_n += pos_n; seed_set_off[tid][0] = 0; seed_set_off[tid][1] = pos_n; off_n += 2; #ifdef MERGE_B_R_VS for(seed_i = 1; seed_i < su_i; seed_i++) { uni_id = seed_tmp[seed_i].uni_id; ref_off1 = seed_tmp[seed_i].ref_pos_off; r_p1 = seed_tmp[seed_i].read_pos; reduce_pn = buffer_pp[uni_id + 1]; bn = reduce_pn - buffer_pp[uni_id]; for(seed_set_i = 0; seed_set_i < seed_i; seed_set_i++) { reduce_sn = seed_set_off[tid][seed_set_i + 1]; sn = reduce_sn - seed_set_off[tid][seed_set_i]; if(bn <= sn) { reduce_s = seed_set_off[tid][seed_set_i]; for(b_p_i = buffer_pp[uni_id]; b_p_i < reduce_pn; b_p_i++) { posp = buffer_p[b_p_i] + ref_off1 - r_p1; #ifdef UNPIPATH_OFF_K20 b_r_s = binsearch_seed_set_reduce64(posp, seedsets[tid], reduce_sn - reduce_s, reduce_s, tid); #else b_r_s = binsearch_seed_set_reduce(posp, seedsets[tid], reduce_sn - reduce_s, reduce_s, tid); #endif if(b_r_s != -1) { for(cov_i = 0; cov_i < cov_a_t; cov_i++) (seedsets[tid][b_r_s].cov)[cov_i] |= (seed_tmp[seed_i].cov)[cov_i]; pos_add[tid][b_p_i - buffer_pp[uni_id]] = 1; if(b_r_s == reduce_sn - 1) break; reduce_s = b_r_s + 1; } else { if(g_low[tid] == reduce_sn - reduce_s) break; else reduce_s += g_low[tid]; } } } else { reduce_p = buffer_pp[uni_id]; for(b_p_i = seed_set_off[tid][seed_set_i]; b_p_i < reduce_sn; b_p_i++) { posp = seedsets[tid][b_p_i].seed_set + r_p1 - ref_off1; #ifdef UNPIPATH_OFF_K20 b_r_s = binsearch_seed_pos_reduce64(posp, buffer_p, reduce_pn - reduce_p, reduce_p, tid); #else b_r_s = binsearch_seed_pos_reduce(posp, buffer_p, reduce_pn - reduce_p, reduce_p, tid); #endif if(b_r_s != -1) { for(cov_i = 0; cov_i < cov_a_t; cov_i++) (seedsets[tid][b_p_i].cov)[cov_i] |= (seed_tmp[seed_i].cov)[cov_i]; pos_add[tid][b_r_s - buffer_pp[uni_id]] = 1; if(b_r_s == reduce_pn - 1) break; reduce_p = b_r_s + 1; } else { if(g_low[tid] == reduce_pn - reduce_p) break; else reduce_p += g_low[tid]; } } } } for(b_p_i = 0; b_p_i < bn; b_p_i++) { if(pos_add[tid][b_p_i] == 0) { seedsets[tid][set_n].seed_set = buffer_p[buffer_pp[uni_id] + b_p_i] + ref_off1 - r_p1; memcpy(seedsets[tid][set_n].cov, seed_tmp[seed_i].cov, (cov_a_t) << 3); seedsets[tid][set_n].ui = seed_tmp[seed_i].ui; seedsets[tid][set_n].ref_pos_off = ref_off1; seedsets[tid][set_n].ref_pos_off_r = seed_tmp[seed_i].ref_pos_off_r; seedsets[tid][set_n].s_r_o_l = seed_tmp[seed_i].s_r_o_l; seedsets[tid][set_n].s_r_o_r = seed_tmp[seed_i].s_r_o_r; seedsets[tid][set_n].tid = tid; ++set_n; } } memset(pos_add[tid], 0, bn); seed_set_off[tid][seed_i + 1] = set_n; ++off_n; } #endif for(off_i = 0; off_i < off_n - 1; off_i++) { interval_n = seed_set_off[tid][off_i + 1] - seed_set_off[tid][off_i]; if(interval_n == 0) continue; qsort(seedsets[tid] + seed_set_off[tid][off_i], interval_n, sizeof(seed_sets), compare_sets); //copy elements from seed_tmp[off_i] as for other elements such as quality set_i_pre = seed_set_off[tid][off_i]; seedpa[spa_i].pos_start = set_i_pre; memcpy(seedpa[spa_i].cov, seedsets[tid][set_i_pre].cov, (cov_a_t) << 3); seedpa[spa_i].ref_pos_off = seedsets[tid][set_i_pre].ref_pos_off; seedpa[spa_i].ref_pos_off_r = seedsets[tid][set_i_pre].ref_pos_off_r; seedpa[spa_i].ui = seedsets[tid][set_i_pre].ui; seedpa[spa_i].s_r_o_l = seedsets[tid][set_i_pre].s_r_o_l; seedpa[spa_i].s_r_o_r = seedsets[tid][set_i_pre].s_r_o_r; //cal number of 1 (length) seedpa[spa_i].length = 0; for(pop_i = 0; pop_i < cov_a_t; pop_i++) seedpa[spa_i].length += popcount_3((seedpa[spa_i].cov)[pop_i]); if(seedpa[spa_i].length > max_sets_n) max_sets_n = seedpa[spa_i].length; ++spa_i; seed_same_n = 1; //copy pos to seed_set_pos (*seed_set_pos)[set_pos_n++] = seedsets[tid][set_i_pre].seed_set; //+ ref_off - r_p for(set_i = set_i_pre + 1; set_i < seed_set_off[tid][off_i + 1]; set_i++) { set_c_r = memcmp(seedsets[tid][set_i_pre].cov, seedsets[tid][set_i].cov, (cov_a_t) << 3); if(set_c_r != 0) { seedpa[spa_i - 1].pos_n = seed_same_n; //copy elements from seed_tmp[off_i] as for other elements such as quality seedpa[spa_i].pos_start = set_i; memcpy(seedpa[spa_i].cov, seedsets[tid][set_i].cov, (cov_a_t) << 3); seedpa[spa_i].ref_pos_off = seedsets[tid][set_i].ref_pos_off; seedpa[spa_i].ref_pos_off_r = seedsets[tid][set_i].ref_pos_off_r; seedpa[spa_i].ui = seedsets[tid][set_i].ui; seedpa[spa_i].s_r_o_l = seedsets[tid][set_i].s_r_o_l; seedpa[spa_i].s_r_o_r = seedsets[tid][set_i].s_r_o_r; //cal number of 1 (length) seedpa[spa_i].length = 0; for(pop_i = 0; pop_i < cov_a_t; pop_i++) seedpa[spa_i].length += popcount_3((seedpa[spa_i].cov)[pop_i]); if(seedpa[spa_i].length > max_sets_n) max_sets_n = seedpa[spa_i].length; ++spa_i; seed_same_n = 1; } else ++seed_same_n; //copy pos to seed_set_pos (*seed_set_pos)[set_pos_n++] = seedsets[tid][set_i].seed_set;// + ref_off - r_p set_i_pre = set_i; } seedpa[spa_i - 1].pos_n = seed_same_n; } #ifdef SINGLE_COV_FILT qsort(seedpa, spa_i, sizeof(seed_pa), compare_plen); for(off_i = 0; off_i < spa_i; off_i++) if(seedpa[off_i].length < max_sets_n - length_reduce) { ++off_i; break; } (*spa1_i) = off_i; #else (*spa1_i) = spa_i; #endif (*seed_num) = spa_i; (*max_seed_length) = max_sets_n; #ifdef PR_COV_FILTER if(seed_l[tid] == COV_FIT_SI) { if(max_sets_n > (read_length >> 1)) cov_filt_f[tid] = 1; } #endif return seedpa; } #ifdef UNPIPATH_OFF_K20 void merge_pair_end64(uint32_t spa1_i, uint32_t spa2_i, seed_pa* seed_pr1, seed_pa* seed_pr2, uint64_t* seed_set_pos1, uint64_t* seed_set_pos2, uint8_t rc_i, uint8_t tid) #else void merge_pair_end(uint32_t spa1_i, uint32_t spa2_i, seed_pa* seed_pr1, seed_pa* seed_pr2, uint32_t* seed_set_pos1, uint32_t* seed_set_pos2, uint8_t rc_i, uint8_t tid) #endif { #ifdef UNPIPATH_OFF_K20 uint64_t posi = 0; uint64_t posp = 0; #else uint32_t posi = 0; uint32_t posp = 0; #endif //uint32_t pospi = 0; uint32_t seed1_i = 0; uint32_t seed2_i = 0; uint32_t psp_i = 0; uint32_t mat_posi1 = 0; int64_t b_s_p_r_i = 0; int64_t b_s_p_r = 0; int64_t reduce_r = 0; int64_t reduce_rn = 0; uint16_t end_dis = 0; if(rc_i == 0) end_dis = end_dis1[tid]; else end_dis = end_dis2[tid]; mat_posi1 = mat_posi[tid]; //match each side of pair-end read for(seed1_i = 0; seed1_i < spa1_i; seed1_i++) { for(seed2_i = 0; seed2_i < spa2_i; seed2_i++) { #ifdef PAIR_B_R_V if(seed_pr1[seed1_i].pos_n <= seed_pr2[seed2_i].pos_n) { reduce_r = seed_pr2[seed2_i].pos_start; reduce_rn = seed_pr2[seed2_i].pos_n + seed_pr2[seed2_i].pos_start; for(psp_i = 0; psp_i < seed_pr1[seed1_i].pos_n; psp_i++) { posi = seed_set_pos1[seed_pr1[seed1_i].pos_start + psp_i]; posp = posi + end_dis; //can add if( != 0Xffffffff) in following binary search function #ifdef UNPIPATH_OFF_K20 b_s_p_r = binsearch_pair_pos_reduce64(posp, seed_set_pos2, reduce_rn - reduce_r, reduce_r, tid); #else b_s_p_r = binsearch_pair_pos_reduce(posp, seed_set_pos2, reduce_rn - reduce_r, reduce_r, tid); #endif if(b_s_p_r != -1) { de_m_p[tid] = 0; if(mat_posi1 < CUS_SEED_SET) { mat_pos1[tid][mat_posi1] = posi; mat_pos2[tid][mat_posi1] = seed_set_pos2[b_s_p_r]; seed_no1[tid][mat_posi1] = seed1_i; seed_no2[tid][mat_posi1] = seed2_i; mat_rc[tid][mat_posi1] = rc_i; ++mat_posi1; } #ifdef PAIR_SEED_LENGTH_FILT if(seed_pr1[seed1_i].length + seed_pr2[seed2_i].length > max_lengtht[tid]) max_lengtht[tid] = seed_pr1[seed1_i].length + seed_pr2[seed2_i].length; #endif if(b_s_p_r == reduce_rn - 1) break; #ifdef PAIR_TRAVERSE for(b_s_p_r_i = b_s_p_r + 1; (seed_set_pos2[b_s_p_r_i] < posp + devi) && (b_s_p_r_i < reduce_rn); b_s_p_r_i++) { if(mat_posi1 < CUS_SEED_SET) { mat_pos1[tid][mat_posi1] = posi; mat_pos2[tid][mat_posi1] = seed_set_pos2[b_s_p_r_i]; seed_no1[tid][mat_posi1] = seed1_i; seed_no2[tid][mat_posi1] = seed2_i; mat_rc[tid][mat_posi1] = rc_i; ++mat_posi1; } } for(b_s_p_r_i = b_s_p_r - 1; (seed_set_pos2[b_s_p_r_i] > posp - devi) && (b_s_p_r_i >= reduce_r); b_s_p_r_i--) { if(mat_posi1 < CUS_SEED_SET) { mat_pos1[tid][mat_posi1] = posi; mat_pos2[tid][mat_posi1] = seed_set_pos2[b_s_p_r_i]; seed_no1[tid][mat_posi1] = seed1_i; seed_no2[tid][mat_posi1] = seed2_i; mat_rc[tid][mat_posi1] = rc_i; ++mat_posi1; } } #endif reduce_r = b_s_p_r + 1; } else { if(r_low[tid] == reduce_rn - reduce_r) break; else reduce_r += r_low[tid]; } } } else { reduce_r = seed_pr1[seed1_i].pos_start; reduce_rn = seed_pr1[seed1_i].pos_n + seed_pr1[seed1_i].pos_start; for(psp_i = 0; psp_i < seed_pr2[seed2_i].pos_n; psp_i++) { posi = seed_set_pos2[seed_pr2[seed2_i].pos_start + psp_i]; posp = posi - end_dis; //can add if( != 0Xffffffff) in following binary search function #ifdef UNPIPATH_OFF_K20 b_s_p_r = binsearch_pair_pos_reduce64(posp, seed_set_pos1, reduce_rn - reduce_r, reduce_r, tid); #else b_s_p_r = binsearch_pair_pos_reduce(posp, seed_set_pos1, reduce_rn - reduce_r, reduce_r, tid); #endif if(b_s_p_r != -1) { de_m_p[tid] = 0; if(mat_posi1 < CUS_SEED_SET) { mat_pos1[tid][mat_posi1] = seed_set_pos1[b_s_p_r]; mat_pos2[tid][mat_posi1] = posi; seed_no1[tid][mat_posi1] = seed1_i; seed_no2[tid][mat_posi1] = seed2_i; mat_rc[tid][mat_posi1] = rc_i; ++mat_posi1; } #ifdef PAIR_SEED_LENGTH_FILT if(seed_pr1[seed1_i].length + seed_pr2[seed2_i].length > max_lengtht[tid]) max_lengtht[tid] = seed_pr1[seed1_i].length + seed_pr2[seed2_i].length; #endif if(b_s_p_r == reduce_rn - 1) break; #ifdef PAIR_TRAVERSE for(b_s_p_r_i = b_s_p_r + 1; (seed_set_pos1[b_s_p_r_i] < posp + devi) && (b_s_p_r_i < reduce_rn); b_s_p_r_i++) { if(mat_posi1 < CUS_SEED_SET) { #ifdef MERGE_MODIFY mat_pos1[tid][mat_posi1] = seed_set_pos1[b_s_p_r_i]; mat_pos2[tid][mat_posi1] = posi; #else mat_pos1[tid][mat_posi1] = posi; mat_pos2[tid][mat_posi1] = seed_set_pos1[b_s_p_r_i]; #endif seed_no1[tid][mat_posi1] = seed1_i; seed_no2[tid][mat_posi1] = seed2_i; mat_rc[tid][mat_posi1] = rc_i; ++mat_posi1; } } for(b_s_p_r_i = b_s_p_r - 1; (seed_set_pos1[b_s_p_r_i] > posp - devi) && (b_s_p_r_i >= reduce_r); b_s_p_r_i--) { if(mat_posi1 < CUS_SEED_SET) { #ifdef MERGE_MODIFY mat_pos1[tid][mat_posi1] = seed_set_pos1[b_s_p_r_i]; mat_pos2[tid][mat_posi1] = posi; #else mat_pos1[tid][mat_posi1] = posi; mat_pos2[tid][mat_posi1] = seed_set_pos1[b_s_p_r_i]; #endif seed_no1[tid][mat_posi1] = seed1_i; seed_no2[tid][mat_posi1] = seed2_i; mat_rc[tid][mat_posi1] = rc_i; ++mat_posi1; } } #endif reduce_r = b_s_p_r + 1; } else { if(r_low[tid] == reduce_rn - reduce_r) break; else reduce_r += r_low[tid]; } } } #endif } } mat_posi[tid] = mat_posi1; } void pair_sam_output(uint8_t tid, uint16_t read_length1, uint16_t read_length2, uint16_t f_cigarn, cnt_re* cnt, uint32_t seqi, uint16_t lv_k1, uint16_t lv_k2, int16_t pound_pos1_f_forward, int16_t pound_pos1_f_reverse, int16_t pound_pos1_r_forward, int16_t pound_pos1_r_reverse, int16_t pound_pos2_f_forward, int16_t pound_pos2_f_reverse, int16_t pound_pos2_r_forward, int16_t pound_pos2_r_reverse, uint8_t cir_n) { //alignment in optimal and suboptimal vectors and output to sam file uint8_t sam_flag1 = 0; uint8_t sam_flag2 = 0; uint16_t v_cnt_out = 0; uint16_t vs_cnt_out = 0; uint16_t d_n1 = 0; uint16_t d_n2 = 0; uint16_t i_n1 = 0; uint16_t i_n2 = 0; uint16_t f_c = 0; uint16_t pchl = 0; uint16_t f_i = 0; uint16_t s_o = 0; uint16_t sn = 0; uint16_t snt = 0; uint16_t read_b_i = 0; uint16_t sam_seq_i = 0; uint16_t xa_i = 0; uint16_t xa_i1 = 0; uint16_t xa_i2 = 0; uint16_t v_cnt_i = 0; uint16_t va_cnt_i = 0; uint32_t v_cnt = 0; uint32_t vs_cnt = 0; int low = 0; int high = 0; int mid = 0; int chr_re = 0; int bit_char_i = 0; int lv_re1f = 0; int lv_re1b = 0; int lv_re2f = 0; int lv_re2b = 0; int lv_re1 = 0; int lv_re2 = 0; int sam_qual1 = 0; int sam_qual2 = 0; int m_m_n = 0; int16_t m_n_f = 0; int16_t m_n_b = 0; int16_t s_r_o_l = 0; int16_t s_r_o_r = 0; int16_t lv_up_left = 0; int16_t lv_up_right = 0; int16_t lv_down_right = 0; int16_t lv_down_left = 0; int16_t pound_pos_1_f = 0; int16_t pound_pos_1_r = 0; int16_t pound_pos_2_f = 0; int16_t pound_pos_2_r = 0; int64_t sam_pos1 = 0; int64_t sam_pos2 = 0; int64_t sam_cross = 0; int64_t sam_pos1_pr = 0; int64_t sam_pos2_pr = 0; uint8_t rc_i = 0; uint8_t rc_ii = 0; char sam_seq1[MAX_READLEN] = {}; char sam_seq2[MAX_READLEN] = {}; char cigarBuf1[MAX_LV_CIGAR] = {}; char cigarBuf2[MAX_LV_CIGAR] = {}; uint16_t f_cigar[MAX_LV_CIGAR]; char str_o[MAX_LV_CIGAR]; char b_cigar[MAX_LV_CIGAR]; char* pch = NULL; char* saveptr = NULL; #ifdef KSW_ALN_PAIR int band_with = 33;//100 int x_score, y_score, op_score, len_score, op_score1, len_score1, op_score2, len_score2; int k_start1 = 0; int k_start2 = 0; int k_middle = 0; uint32_t* cigar1 = NULL; uint32_t* cigar2 = NULL; int n_cigar1 = 0; int n_cigar2 = 0; int nm_score = 0; #endif #ifdef QUAL_FILT_LV_OUT uint8_t* qual_filt_lv_1 = NULL; uint8_t* qual_filt_lv_1_o = NULL; uint8_t* qual_filt_lv_2 = NULL; uint8_t* qual_filt_lv_2_o = NULL; #endif char cigar_p1[MAX_LV_CIGARCOM]; char cigar_p2[MAX_LV_CIGARCOM]; uint16_t s_offset1 = 0; uint16_t s_offset2 = 0; #ifdef MAPPING_QUALITY float log_tmp = 0; float* mp_subs_1 = NULL; float* mp_subs_1_o = NULL; float* mp_subs_2 = NULL; float* mp_subs_2_o = NULL; uint8_t mp_flag = 0; #endif uint8_t ops_flag = 1; #ifdef UNPIPATH_OFF_K20 uint64_t x = 0; #else uint32_t x = 0; #endif uint64_t chr_re_tmp = 0; v_cnt = cnt->v_cnt; vs_cnt = cnt->vs_cnt; v_cnt_out = (cus_ali_n < v_cnt) ? cus_ali_n:v_cnt; v_cnt_i = 0; #ifdef CIGAR_LEN_ERR int cigar_len = 0; int cigar_len_tmp = 0; int cigar_len_re = 0; uint16_t pchl_tmp = 0; uint16_t s_o_tmp = 0; char* pch_tmp = NULL; char* saveptr_tmp = NULL; char cigar_tmp[MAX_LV_CIGARCOM]; #endif #ifdef ALTER_DEBUG if((v_cnt > 1) && (rep_go[tid])) v_cnt_i = seed_length_arr[tid][v_cnt_i].index; #endif #ifdef MAPPING_QUALITY if(v_cnt > 1) { sam_qual1 = 0; sam_qual2 = 0; mp_flag = 0; } else if(vs_cnt == 0) { sam_qual1 = 60; sam_qual2 = 60; mp_flag = 0; } else { mp_flag = 1; } #endif x = op_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos1 = op_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; sam_pos2 = op_vector_pos2[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; if(op_rc[tid][v_cnt_i] == 0) { sam_flag1 = 99; sam_flag2 = 147; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); strcpy(sam_seq1, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_LV_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; qual_filt_lv_2 = qual_filt_lv2[tid][1]; qual_filt_lv_2_o = qual_filt_lv2[tid][0]; #endif sam_cross = sam_pos2 + read_length2 - sam_pos1; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; #ifdef MAPPING_QUALITY if(mp_flag) { mp_subs_1 = mp_subs1[tid][0]; mp_subs_1_o = mp_subs1[tid][1]; mp_subs_2 = mp_subs2[tid][1]; mp_subs_2_o = mp_subs2[tid][0]; } #endif } else { sam_flag1 = 83; sam_flag2 = 163; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #ifdef QUAL_FILT_LV_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; qual_filt_lv_2 = qual_filt_lv2[tid][0]; qual_filt_lv_2_o = qual_filt_lv2[tid][1]; #endif sam_cross = sam_pos2 - read_length1 - sam_pos1; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; #ifdef MAPPING_QUALITY if(mp_flag) { mp_subs_1 = mp_subs1[tid][1]; mp_subs_1_o = mp_subs1[tid][0]; mp_subs_2 = mp_subs2[tid][0]; mp_subs_2_o = mp_subs2[tid][1]; } #endif } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = op_dm_l1[tid][v_cnt_i]; s_r_o_r = op_dm_r1[tid][v_cnt_i]; #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] = 0; #endif if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m1[tid]); #ifdef MAPPING_QUALITY if(mp_flag) { for (bit_char_i = 0, read_b_i = 32; bit_char_i < read_length1; bit_char_i++, read_b_i++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((op_vector_seq1[tid][v_cnt_i][read_b_i >> 5] >> ((31 - (read_b_i & 0X1f)) << 1)) & 0X3)) { sub_t[tid] += mp_subs_1[bit_char_i]; } } #endif } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR #ifdef CHAR_CP for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kl1[tid][v_cnt_i], read_char[tid], op_dm_kl1[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr1[tid][v_cnt_i], read_char2[tid], op_dm_kr1[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if (n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if (n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if (s_r_o_l >= op_dm_kl1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", s_r_o_l + 1 - op_dm_kl1[tid][v_cnt_i]); snt += sn; } if ((s_r_o_l != -1) && (s_r_o_r != read_length1)) { if ((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if (op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if (op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_1_o[read_length1 + n_cigar1 - s_r_o_l - x_score - read_b_i - 2]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if (s_r_o_l == -1) { if (op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if (op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_1_o[read_length1 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; } if (read_length1 - s_r_o_r > op_dm_kr1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", read_length1 - s_r_o_r - op_dm_kr1[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; if (n_cigar1) free(cigar1); if (n_cigar2) free(cigar2); op_dm_ex1[tid][v_cnt_i] = nm_score; #endif } else { if(pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if(pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_LV_OUT #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mis_left_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1, mp_subs_1_o + read_length1 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mis_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left, mp_subs_1 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #else #ifdef CHAR_CP for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], mp_subs_1_o + read_length1 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], mp_subs_1 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p1 + snt, "%uS", lv_up_left); snt += sn; } #else if(m_n_f) { if(f_c) { if(f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) //(op_dm_l1[tid][v_cnt_i] != -1) && (op_dm_r1[tid][v_cnt_i] != read_length1) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if(b_cigar[pchl] == 'M') { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length1) { sn = sprintf(cigar_p1 + snt, "%uS", read_length1 - lv_down_right); snt += sn; } #else if(m_n_b) { if(cigar_p1[snt - 1] == 'M') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p1[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_b); snt += sn; } } #endif //sprintf(cigar_p1 + snt, "\0"); } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length1 != cigar_len) { if(read_length1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length1); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m1[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length1 - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif } d_n2 = 0; i_n2 = 0; s_r_o_l = op_dm_l2[tid][v_cnt_i]; s_r_o_r = op_dm_r2[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m2[tid]); #ifdef MAPPING_QUALITY if(mp_flag) { for (bit_char_i = 0, read_b_i = 32; bit_char_i < read_length2; bit_char_i++, read_b_i++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((op_vector_seq2[tid][v_cnt_i][read_b_i >> 5] >> ((31 - (read_b_i & 0X1f)) << 1)) & 0X3)) { sub_t[tid] += mp_subs_2[bit_char_i]; } } #endif } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR #ifdef CHAR_CP for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq2[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kl2[tid][v_cnt_i], read_char[tid], op_dm_kl2[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq2[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr2[tid][v_cnt_i], read_char2[tid], op_dm_kr2[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if (n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if (n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if (s_r_o_l >= op_dm_kl2[tid][v_cnt_i]) { sn = sprintf(cigar_p2 + snt, "%dS", s_r_o_l + 1 - op_dm_kl2[tid][v_cnt_i]); snt += sn; } if ((s_r_o_l != -1) && (s_r_o_r != read_length2)) { if ((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if (op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if (op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_2_o[read_length2 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_2[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if (s_r_o_l == -1) { if (op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_2[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if (op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if(mp_flag) sub_t[tid] += mp_subs_2_o[read_length2 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; } if (read_length2 - s_r_o_r > op_dm_kr2[tid][v_cnt_i]) { sn = sprintf(cigar_p2 + snt, "%dS", read_length2 - s_r_o_r - op_dm_kr2[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p2 + snt, "\0"); //snt += sn; if (n_cigar1) free(cigar1); if (n_cigar2) free(cigar2); op_dm_ex2[tid][v_cnt_i] = nm_score; #endif } else { #ifdef OUTPUT_DEBUG if (pound_pos_2_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_2_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length2 - pound_pos_2_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if (pound_pos_2_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_2_r;//21 lv_up_right = s_r_o_l;//20 lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = pound_pos_2_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if ((pound_pos_2_f <= s_r_o_l + 1) && (pound_pos_2_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_2_f - 1; lv_down_right = read_length2; lv_down_left = pound_pos_2_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_2_r - pound_pos_2_f; } else if ((pound_pos_2_f > s_r_o_l + 1) && (pound_pos_2_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = pound_pos_2_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length2 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_LV_OUT #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mis_left_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2, mp_subs_2_o + read_length2 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2);//, 0, op_dm_sl1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mis_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left, mp_subs_2 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #else #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], mp_subs_2_o + read_length2 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if(mp_flag) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], mp_subs_2 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif #endif //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if (str_o[s_o - 1] == 'D') d_n2 += atoi(pch); if (str_o[s_o - 1] == 'I') i_n2 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if (pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if (m_n_f) { if(f_c) { if (f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if ((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) { if ((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if (b_cigar[pchl] == 'M') { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if (b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length2) { sn = sprintf(cigar_p2 + snt, "%uS", read_length2 - lv_down_right); snt += sn; } #else if (m_n_b) { if (cigar_p2[snt - 1] == 'M') { for (bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if ((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif //sprintf(cigar_p2 + snt, "\0"); } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length2 != cigar_len) { if(read_length2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m2[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } #ifdef MAPPING_QUALITY if(mp_flag) { sam_qual1 = sub_t[tid]; } #endif sam_pos1_pr = sam_pos1 + i_n1 - d_n1 + s_offset1; sam_pos2_pr = sam_pos2 + i_n2 - d_n2 + s_offset2; chr_re_tmp = chr_end_n[chr_re] - chr_end_n[chr_re - 1]; if(sam_pos1_pr <= 0) { sam_pos1_pr = 1; } else { if((sam_pos1_pr + read_length1 - 1) > chr_re_tmp) sam_pos1_pr = chr_re_tmp - 1 - read_length1; } if(sam_pos2_pr <= 0) { sam_pos2_pr = 1; } else { if((sam_pos2_pr + read_length2 - 1) > chr_re_tmp) sam_pos2_pr = chr_re_tmp - 1 - read_length2; } #ifdef OUTPUT_ARR seqio[seqi].flag1 = sam_flag1; seqio[seqi].flag2 = sam_flag2; //seqio[seqi].chr_re = chr_re; seqio[seqi].chr_re1 = chr_re; seqio[seqi].chr_re2 = chr_re; seqio[seqi].pos1 = sam_pos1_pr; seqio[seqi].pos2 = sam_pos2_pr; seqio[seqi].cross = sam_cross; seqio[seqi].nm1 = op_dm_ex1[tid][v_cnt_i]; seqio[seqi].nm2 = op_dm_ex2[tid][v_cnt_i]; strcpy(pr_cigar1_buffer[seqi], cigar_p1); seqio[seqi].cigar1 = pr_cigar1_buffer[seqi]; strcpy(pr_cigar2_buffer[seqi], cigar_p2); seqio[seqi].cigar2 = pr_cigar2_buffer[seqi]; if(sam_flag1 == 99) { #ifdef CHAR_CP for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); #endif strcpy(read_rev_buffer[seqi], sam_seq2); read_rev_buffer[seqi][read_length2] = '\0'; seqio[seqi].seq2 = read_rev_buffer[seqi]; seqio[seqi].seq1 = seqio[seqi].read_seq1; strrev1(qual2_buffer[seqi]); seqio[seqi].qual1 = qual1_buffer[seqi]; seqio[seqi].qual2 = qual2_buffer[seqi]; } else { #ifdef CHAR_CP for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #endif strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length1] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; seqio[seqi].seq2 = seqio[seqi].read_seq2; strrev1(qual1_buffer[seqi]); seqio[seqi].qual1 = qual1_buffer[seqi]; seqio[seqi].qual2 = qual2_buffer[seqi]; } #endif //} xa_i = 0; for(va_cnt_i = 1; va_cnt_i < v_cnt_out; va_cnt_i++) { #ifdef ALTER_DEBUG if(rep_go[tid]) v_cnt_i = seed_length_arr[tid][va_cnt_i].index; else v_cnt_i = va_cnt_i; #else v_cnt_i = va_cnt_i; #endif x = op_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos1 = op_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; sam_pos2 = op_vector_pos2[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; chr_res[tid][xa_i] = chr_re; if(op_rc[tid][v_cnt_i] == 0) { #ifdef OUPUT_REPEAT sam_flag1 = 99; sam_flag2 = 147; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); strcpy(sam_seq1, seqio[seqi].read_seq1); #endif #endif #ifdef QUAL_FILT_LV_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; qual_filt_lv_2 = qual_filt_lv2[tid][1]; qual_filt_lv_2_o = qual_filt_lv2[tid][0]; #endif sam_cross = sam_pos2 + read_length2 - sam_pos1; xa_d1s[tid][xa_i] = '+'; xa_d2s[tid][xa_i] = '-'; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; } else { #ifdef OUPUT_REPEAT sam_flag1 = 83; sam_flag2 = 163; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #endif #ifdef QUAL_FILT_LV_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; qual_filt_lv_2 = qual_filt_lv2[tid][0]; qual_filt_lv_2_o = qual_filt_lv2[tid][1]; #endif sam_cross = sam_pos2 - read_length1 - sam_pos1; xa_d1s[tid][xa_i] = '-'; xa_d2s[tid][xa_i] = '+'; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = op_dm_l1[tid][v_cnt_i]; s_r_o_r = op_dm_r1[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m1[tid]); lv_re1 = op_dm_ex1[tid][v_cnt_i]; } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR #ifdef CHAR_CP for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kl1[tid][v_cnt_i], read_char[tid], op_dm_kl1[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr1[tid][v_cnt_i], read_char2[tid], op_dm_kr1[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if (n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if (n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if (s_r_o_l >= op_dm_kl1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", s_r_o_l + 1 - op_dm_kl1[tid][v_cnt_i]); snt += sn; } if ((s_r_o_l != -1) && (s_r_o_r != read_length1)) { if ((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if (op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if (op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if (s_r_o_l == -1) { if (op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if (op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; } if (read_length1 - s_r_o_r > op_dm_kr1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", read_length1 - s_r_o_r - op_dm_kr1[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; if (n_cigar1) free(cigar1); if (n_cigar2) free(cigar2); lv_re1 = nm_score; #endif } else { #ifdef OUTPUT_DEBUG if (pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if (pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if ((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if ((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_LV_OUT #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re1f = computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re1b = computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re1f = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re1b = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif lv_re1 = lv_re1f + lv_re1b; //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if (str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if (str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if (pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p1 + snt, "%uS", lv_up_left); snt += sn; } #else if (m_n_f) { if(f_c) { if (f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if ((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) { if ((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if (b_cigar[pchl] == 'M') { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if (b_cigar[pchl] == 'M') { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length1) { sn = sprintf(cigar_p1 + snt, "%uS", read_length1 - lv_down_right); snt += sn; } #else if (m_n_b) { if (cigar_p1[snt - 1] == 'M') { for (bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if ((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p1[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_b); snt += sn; } } #endif //sprintf(cigar_p1 + snt, "\0"); } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length1 != cigar_len) { if(read_length1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length1); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m1[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length1 - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif } d_n2 = 0; i_n2 = 0; s_r_o_l = op_dm_l2[tid][v_cnt_i]; s_r_o_r = op_dm_r2[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m2[tid]); lv_re2 = op_dm_ex2[tid][v_cnt_i]; } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR #ifdef CHAR_CP for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq2[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kl2[tid][v_cnt_i], read_char[tid], op_dm_kl2[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq2[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr2[tid][v_cnt_i], read_char2[tid], op_dm_kr2[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if (n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if (n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if (s_r_o_l >= op_dm_kl2[tid][v_cnt_i]) { sn = sprintf(cigar_p2 + snt, "%dS", s_r_o_l + 1 - op_dm_kl2[tid][v_cnt_i]); snt += sn; } if ((s_r_o_l != -1) && (s_r_o_r != read_length2)) { if ((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if (op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if (op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if (s_r_o_l == -1) { if (op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if (op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; } if (read_length2 - s_r_o_r > op_dm_kr2[tid][v_cnt_i]) { sn = sprintf(cigar_p2 + snt, "%dS", read_length2 - s_r_o_r - op_dm_kr2[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p2 + snt, "\0"); //snt += sn; if (n_cigar1) free(cigar1); if (n_cigar2) free(cigar2); lv_re2 = nm_score; #endif } else { #ifdef OUTPUT_DEBUG if (pound_pos_2_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_2_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length2 - pound_pos_2_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if (pound_pos_2_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_2_r;// lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = pound_pos_2_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if ((pound_pos_2_f <= s_r_o_l + 1) && (pound_pos_2_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_2_f - 1; lv_down_right = read_length2; lv_down_left = pound_pos_2_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_2_r - pound_pos_2_f; } else if ((pound_pos_2_f > s_r_o_l + 1) && (pound_pos_2_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = pound_pos_2_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length2 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_LV_OUT #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re2f = computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re2b = computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re2f = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif lv_re2b = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif lv_re2 = lv_re2f + lv_re2b; //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if (str_o[s_o - 1] == 'D') d_n2 += atoi(pch); if (str_o[s_o - 1] == 'I') i_n2 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if (pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if (m_n_f) { if(f_c) { if (f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if ((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) { if ((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if (b_cigar[pchl] == 'M') { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if (b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length2) { sn = sprintf(cigar_p2 + snt, "%uS", read_length2 - lv_down_right); snt += sn; } #else if (m_n_b) { if (cigar_p2[snt - 1] == 'M') { for (bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if ((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif //sprintf(cigar_p2 + snt, "\0"); } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length2 != cigar_len) { if(read_length2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m2[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } sam_pos1s[tid][xa_i] = (uint32_t )(sam_pos1 + i_n1 - d_n1 + s_offset1); sam_pos2s[tid][xa_i] = (uint32_t )(sam_pos2 + i_n2 - d_n2 + s_offset2); strcpy(cigar_p1s[tid][xa_i], cigar_p1); strcpy(cigar_p2s[tid][xa_i], cigar_p2); lv_re1s[tid][xa_i] = lv_re1; lv_re2s[tid][xa_i] = lv_re2; ++xa_i; } //suboptimal vs_cnt_out = (cus_ali_n < vs_cnt) ? cus_ali_n:vs_cnt; #ifdef ALL_ALL for(v_cnt_i = 0; v_cnt_i < vs_cnt_out; v_cnt_i++) #else if((mgn_flag) && (v_cnt_out > 1)) ops_flag = 0; for(v_cnt_i = 0; (v_cnt_i < vs_cnt_out) && (dm_op[tid] + 3 > dm_ops[tid]) && ops_flag; v_cnt_i++)// && (v_cnt_out < 2) #endif { x = ops_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos1 = ops_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; sam_pos2 = ops_vector_pos2[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; chr_res[tid][xa_i] = chr_re; if(ops_rc[tid][v_cnt_i] == 0) { #ifdef OUPUT_REPEAT sam_flag1 = 99; sam_flag2 = 147; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][0]; read_bit_2[tid] = read_bit2[tid][1]; #else for(sam_seq_i = 0; sam_seq_i < read_length2; sam_seq_i++) sam_seq2[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq2[sam_seq_i]] ^ 0X3]; sam_seq2[sam_seq_i] = '\0'; strrev1(sam_seq2); strcpy(sam_seq1, seqio[seqi].read_seq1); #endif #endif #ifdef QUAL_FILT_LV_OUT qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; qual_filt_lv_2 = qual_filt_lv2[tid][1]; qual_filt_lv_2_o = qual_filt_lv2[tid][0]; #endif sam_cross = sam_pos2 + read_length2 - sam_pos1; xa_d1s[tid][xa_i] = '+'; xa_d2s[tid][xa_i] = '-'; pound_pos_1_f = pound_pos1_f_forward; pound_pos_1_r = pound_pos1_r_forward; pound_pos_2_f = pound_pos2_f_reverse; pound_pos_2_r = pound_pos2_r_reverse; #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) { mp_subs_1 = mp_subs1[tid][0]; mp_subs_1_o = mp_subs1[tid][1]; mp_subs_2 = mp_subs2[tid][1]; mp_subs_2_o = mp_subs2[tid][0]; } #endif } else { #ifdef OUPUT_REPEAT sam_flag1 = 83; sam_flag2 = 163; #ifdef CHAR_CP read_bit_1[tid] = read_bit1[tid][1]; read_bit_2[tid] = read_bit2[tid][0]; #else for(sam_seq_i = 0; sam_seq_i < read_length1; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); strcpy(sam_seq2, seqio[seqi].read_seq2); #endif #endif #ifdef QUAL_FILT_LV_OUT qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; qual_filt_lv_2 = qual_filt_lv2[tid][0]; qual_filt_lv_2_o = qual_filt_lv2[tid][1]; #endif sam_cross = sam_pos2 - read_length1 - sam_pos1; xa_d1s[tid][xa_i] = '-'; xa_d2s[tid][xa_i] = '+'; pound_pos_1_f = pound_pos1_f_reverse; pound_pos_1_r = pound_pos1_r_reverse; pound_pos_2_f = pound_pos2_f_forward; pound_pos_2_r = pound_pos2_r_forward; #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) { mp_subs_1 = mp_subs1[tid][1]; mp_subs_1_o = mp_subs1[tid][0]; mp_subs_2 = mp_subs2[tid][0]; mp_subs_2_o = mp_subs2[tid][1]; } #endif } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_offset2 = 0; s_r_o_l = ops_dm_l1[tid][v_cnt_i]; s_r_o_r = ops_dm_r1[tid][v_cnt_i]; #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] = 0; #endif if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m1[tid]); lv_re1 = ops_dm_ex1[tid][v_cnt_i]; #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) { for (bit_char_i = 0, read_b_i = 32; bit_char_i < read_length1; bit_char_i++, read_b_i++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ops_vector_seq1[tid][v_cnt_i][read_b_i >> 5] >> ((31 - (read_b_i & 0X1f)) << 1)) & 0X3)) { sub_t[tid] += mp_subs_1[bit_char_i]; } } #endif } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR #ifdef CHAR_CP for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(ops_dm_kl1[tid][v_cnt_i], read_char[tid], ops_dm_kl1[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(ops_dm_kr1[tid][v_cnt_i], read_char2[tid], ops_dm_kr1[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if (n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if (n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if (s_r_o_l >= ops_dm_kl1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", s_r_o_l + 1 - ops_dm_kl1[tid][v_cnt_i]); snt += sn; } if ((s_r_o_l != -1) && (s_r_o_r != read_length1)) { if ((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if (op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if (op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1_o[read_length1 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if (s_r_o_l == -1) { if (op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if (op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1_o[read_length1 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; } if (read_length1 - s_r_o_r > ops_dm_kr1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", read_length1 - s_r_o_r - ops_dm_kr1[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; if (n_cigar1) free(cigar1); if (n_cigar2) free(cigar2); lv_re1 = nm_score; #endif } else { #ifdef OUTPUT_DEBUG if (pound_pos_1_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_1_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length1 - pound_pos_1_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if (pound_pos_1_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_1_r;// lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = pound_pos_1_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if ((pound_pos_1_f <= s_r_o_l + 1) && (pound_pos_1_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_1_f - 1; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_1_r - pound_pos_1_f; } else if ((pound_pos_1_f > s_r_o_l + 1) && (pound_pos_1_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length1; lv_down_left = pound_pos_1_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length1 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length1; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_LV_OUT #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re1f = computeEditDistanceWithCigar_s_mis_left_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1, mp_subs_1_o + read_length1 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else lv_re1f = computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] #else lv_re1f = computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length1 - 1 - lv_up_right, &s_offset1);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re1b = computeEditDistanceWithCigar_s_mis_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left, mp_subs_1 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else lv_re1b = computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else lv_re1b = computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #else #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re1f = computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid], mp_subs_1_o + read_length1 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else lv_re1f = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #else lv_re1f = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k1, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re1b = computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid], mp_subs_1 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else lv_re1b = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #else lv_re1b = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k1, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif #endif lv_re1 = lv_re1f + lv_re1b; //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if (str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if (str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if (pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p1 + snt, "%uS", lv_up_left); snt += sn; } #else if (m_n_f) { if(f_c) { if (f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if ((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) { if ((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if (b_cigar[pchl] == 'M') { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if (b_cigar[pchl] == 'M') { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length1) { sn = sprintf(cigar_p1 + snt, "%uS", read_length1 - lv_down_right); snt += sn; } #else if (m_n_b) { if (cigar_p1[snt - 1] == 'M') { for (bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if ((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p1[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p1[bit_char_i] > 64) && (cigar_p1[bit_char_i] < 91)) break; m_n_b += (cigar_p1[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p1 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p1 + snt, "%uM", m_n_b); snt += sn; } } #endif //sprintf(cigar_p1 + snt, "\0"); } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length1 != cigar_len) { if(read_length1 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length1); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m1[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length1 - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif } d_n2 = 0; i_n2 = 0; s_r_o_l = ops_dm_l2[tid][v_cnt_i]; s_r_o_r = ops_dm_r2[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p2, cigar_m2[tid]); lv_re2 = ops_dm_ex2[tid][v_cnt_i]; #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) { for (bit_char_i = 0, read_b_i = 32; bit_char_i < read_length2; bit_char_i++, read_b_i++) if(((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ops_vector_seq2[tid][v_cnt_i][read_b_i >> 5] >> ((31 - (read_b_i & 0X1f)) << 1)) & 0X3)) { sub_t[tid] += mp_subs_2[bit_char_i]; } } #endif } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN_PAIR #ifdef CHAR_CP for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = charToDna5n[sam_seq2[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl2[tid][v_cnt_i]; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(ops_dm_kl2[tid][v_cnt_i], read_char[tid], ops_dm_kl2[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++) read_char2[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++) read_char2[tid][read_b_i] = charToDna5n[sam_seq2[bit_char_i]]; #endif for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr2[tid][v_cnt_i]; bit_char_i++, read_b_i++) ali_ref_seq2[tid][read_b_i] = ((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(ops_dm_kr2[tid][v_cnt_i], read_char2[tid], ops_dm_kr2[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if (n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if (n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if (s_r_o_l >= ops_dm_kl2[tid][v_cnt_i]) { sn = sprintf(cigar_p2 + snt, "%dS", s_r_o_l + 1 - ops_dm_kl2[tid][v_cnt_i]); snt += sn; } if ((s_r_o_l != -1) && (s_r_o_r != read_length2)) { if ((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if (op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if (op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_2_o[read_length2 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_2[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if (s_r_o_l == -1) { if (op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_2[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if (op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p2 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) { // match for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_2_o[read_length2 + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p2 + snt, "%dM", k_middle); snt += sn; } if (read_length2 - s_r_o_r > ops_dm_kr2[tid][v_cnt_i]) { sn = sprintf(cigar_p2 + snt, "%dS", read_length2 - s_r_o_r - ops_dm_kr2[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p2 + snt, "\0"); //snt += sn; if (n_cigar1) free(cigar1); if (n_cigar2) free(cigar2); lv_re2 = nm_score; #endif } else { #ifdef OUTPUT_DEBUG if (pound_pos_2_f >= s_r_o_r) //1 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = pound_pos_2_f; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = read_length2 - pound_pos_2_f; m_m_n = s_r_o_r - s_r_o_l - 1; } else if (pound_pos_2_r <= s_r_o_l + 1) //5 { lv_up_left = pound_pos_2_r;// lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = pound_pos_2_r; m_n_b = 0; m_m_n = s_r_o_r - s_r_o_l - 1; } else if ((pound_pos_2_f <= s_r_o_l + 1) && (pound_pos_2_r >= s_r_o_r)) //2 { lv_up_left = 0; lv_up_right = pound_pos_2_f - 1; lv_down_right = read_length2; lv_down_left = pound_pos_2_r; m_n_f = 0; m_n_b = 0; m_m_n = pound_pos_2_r - pound_pos_2_f; } else if ((pound_pos_2_f > s_r_o_l + 1) && (pound_pos_2_f < s_r_o_r)) //3 { lv_up_left = 0; lv_up_right = s_r_o_l; lv_down_right = read_length2; lv_down_left = pound_pos_2_r; m_n_f = 0; m_n_b = 0; m_m_n = read_length2 - s_r_o_l - 1; } else //4 { lv_up_left = 0; lv_up_right = -1; lv_down_right = read_length2; lv_down_left = s_r_o_r; m_n_f = 0; m_n_b = 0; m_m_n = s_r_o_r; } #ifdef QUAL_FILT_LV_OUT #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re2f = computeEditDistanceWithCigar_s_mis_left_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2, mp_subs_2_o + read_length2 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else lv_re2f = computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2);//, 0, op_dm_sl1[tid][v_cnt_i] #else lv_re2f = computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_2_o + read_length2 - 1 - lv_up_right, &s_offset2);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re2b = computeEditDistanceWithCigar_s_mis_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left, mp_subs_2 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else lv_re2b = computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #else lv_re2b = computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_2 + lv_down_left);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #else #ifdef CHAR_CP for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_up_right, read_b_i = 0; bit_char_i >= lv_up_left; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_up_right, read_b_i = 0; bit_char_i > lv_up_left - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re2f = computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid], mp_subs_2_o + read_length2 - 1 - lv_up_right, &(sub_t[tid]));//, 0, op_dm_sl1[tid][v_cnt_i] else lv_re2f = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #else lv_re2f = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + lv_up_right - lv_up_left, read_char[tid], lv_up_right + 1 - lv_up_left, lv_k2, cigarBuf1, f_cigarn, L[tid]);//, 0, op_dm_sl1[tid][v_cnt_i] #endif #ifdef CHAR_CP for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_2[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for (bit_char_i = lv_down_left, read_b_i = 0; bit_char_i < lv_down_right; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq2[bit_char_i]; for (bit_char_i = 32 + lv_down_left, read_b_i = 0; bit_char_i < lv_down_right + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq2[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY if((mp_flag) && (v_cnt_i == 0)) lv_re2b = computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid], mp_subs_2 + lv_down_left, &(sub_t[tid]));//, 0, op_dm_sr1[tid][v_cnt_i] else lv_re2b = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #else lv_re2b = computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + lv_down_right - lv_down_left, read_char[tid], lv_down_right - lv_down_left, lv_k2, cigarBuf2, f_cigarn, L[tid]);//, 0, op_dm_sr1[tid][v_cnt_i] #endif #endif #endif lv_re2 = lv_re2f + lv_re2b; //deal with front and back lv cigar strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if (str_o[s_o - 1] == 'D') d_n2 += atoi(pch); if (str_o[s_o - 1] == 'I') i_n2 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok(cigarBuf2,"DMIS"); if (pch != NULL) pchl = strlen(pch); snt = 0; #ifdef CIGAR_S_MODIFY if(lv_up_left) { sn = sprintf(cigar_p2 + snt, "%uS", lv_up_left); snt += sn; } #else if (m_n_f) { if(f_c) { if (f_cigar[f_cigarn + 1 - f_c] == 'M') { f_cigar[f_cigarn - f_c] += m_n_f; } else if(f_cigar[f_cigarn + 1 - f_c] == 'S') { f_cigar[f_cigarn - f_c] += m_n_f; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_f); snt += sn; } } else m_m_n += m_n_f; } #endif if ((lv_up_right >= lv_up_left) && (lv_down_right > lv_down_left)) { if ((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%s",b_cigar); snt += sn; } else if (b_cigar[pchl] == 'M') { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_up_right < lv_up_left) && (lv_down_right > lv_down_left)) //op_dm_l1[tid][v_cnt_i] == -1 { if (b_cigar[pchl] == 'M') { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { sn = sprintf(cigar_p2 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if ((lv_down_right <= lv_down_left) && (lv_up_right >= lv_up_left)) { if (f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for (f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p2 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } } else { sn = sprintf(cigar_p2 + snt, "%uM", m_m_n); snt += sn; } #ifdef CIGAR_S_MODIFY if(lv_down_right < read_length2) { sn = sprintf(cigar_p2 + snt, "%uS", read_length2 - lv_down_right); snt += sn; } #else if (m_n_b) { if (cigar_p2[snt - 1] == 'M') { for (bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if ((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uM", m_n_b); snt = bit_char_i + 1 + sn; } else if(cigar_p2[snt - 1] == 'S') { for(bit_char_i = snt - 2, f_i = 0; bit_char_i > -1; bit_char_i--, f_i++) { if((cigar_p2[bit_char_i] > 64) && (cigar_p2[bit_char_i] < 91)) break; m_n_b += (cigar_p2[bit_char_i] - '0') * carry_ten[f_i]; } sn = sprintf(cigar_p2 + bit_char_i + 1, "%uS", m_n_b); snt = bit_char_i + 1 + sn; } else { sn = sprintf(cigar_p2 + snt, "%uM", m_n_b); snt += sn; } } #endif //sprintf(cigar_p2 + snt, "\0"); } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; strncpy(cigar_tmp, cigar_p2, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p2[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length2 != cigar_len) { if(read_length2 < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length2); if(cigar_len_re > 0) sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p2 + snt - sn, "\0"); else strcpy(cigar_p2, cigar_m2[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length2 - cigar_len); sprintf(cigar_p2 + snt - sn, "%u%c", cigar_len_re, cigar_p2[snt - 1]); } } #endif } sam_pos1s[tid][xa_i] = (uint32_t )(sam_pos1 + i_n1 - d_n1 + s_offset1); sam_pos2s[tid][xa_i] = (uint32_t )(sam_pos2 + i_n2 - d_n2 + s_offset2); strcpy(cigar_p1s[tid][xa_i], cigar_p1); strcpy(cigar_p2s[tid][xa_i], cigar_p2); lv_re1s[tid][xa_i] = lv_re1; lv_re2s[tid][xa_i] = lv_re2; ++xa_i; } #ifdef MAPPING_QUALITY if(mp_flag) { if(xa_i) { log_tmp = log(vs_cnt); sam_qual1 = (sam_qual1 - sub_t[tid] - log_tmp) * 3.434; sam_qual1 = (sam_qual1 > 2 ? sam_qual1 : 2); #ifdef QUAL_20 sam_qual1 = (sam_qual1 < 20 ? 20 : sam_qual1); #endif sam_qual1 = (sam_qual1 > 60 ? 60 : sam_qual1); sam_qual2 = sam_qual1; #ifdef MP_DEBUG printf("2: %d %d\n\n", sam_qual1, sam_qual2); #endif } else { sam_qual1 = 60; sam_qual2 = 60; } } #endif seqio[seqi].qualc1 = sam_qual1; seqio[seqi].qualc2 = sam_qual2; #ifdef PR_SINGLE //plug-in single positions output xa_i1 = 0; xa_i2 = 0; if(pr_o_f[tid] == 1) { for(rc_i = 0; rc_i < 2; rc_i++) for(rc_ii = 0; rc_ii < 2; rc_ii++) for(v_cnt_i = 0; v_cnt_i < seedpos_misn[rc_i][rc_ii][tid]; v_cnt_i++) { if(seedpos_mis[rc_i][rc_ii][tid][v_cnt_i] == min_mis[tid]) { x = seedpos[rc_i][rc_ii][tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } if(rc_i == rc_ii) { if(xa_i1 < pr_single_outputn) { pr_chr_res1[tid][xa_i1] = chr_re; pr_sam_pos1[tid][xa_i1] = x - chr_end_n[chr_re - 1] + 1; pr_xa_d1[tid][xa_i1] = pr_dir[rc_ii]; pr_lv_re1[tid][xa_i1] = min_mis[tid]; xa_i1++; } } else { if(xa_i2 < pr_single_outputn) { pr_chr_res2[tid][xa_i2] = chr_re; pr_sam_pos2[tid][xa_i2] = x - chr_end_n[chr_re - 1] + 1; pr_xa_d2[tid][xa_i2] = pr_dir[rc_ii]; pr_lv_re2[tid][xa_i2] = min_mis[tid]; xa_i2++; } } } } } #endif seqio[seqi].v_cnt = v_cnt_out; //seqio[seqi].xa_n = xa_i; seqio[seqi].xa_n_p1 = xa_i; seqio[seqi].xa_n_p2 = xa_i; #ifdef FIX_SV seqio[seqi].xa_n_x1 = 0; seqio[seqi].xa_n_x2 = 0; #endif if(xa_i > 0) { memcpy(chr_res_buffer[seqi], chr_res[tid], xa_i << 2); seqio[seqi].chr_res = chr_res_buffer[seqi]; memcpy(xa_d1s_buffer[seqi], xa_d1s[tid], xa_i); seqio[seqi].xa_d1s = xa_d1s_buffer[seqi]; memcpy(sam_pos1s_buffer[seqi], sam_pos1s[tid], xa_i << 2); seqio[seqi].sam_pos1s = sam_pos1s_buffer[seqi]; memcpy(lv_re1s_buffer[seqi], lv_re1s[tid], xa_i << 2); seqio[seqi].lv_re1s = lv_re1s_buffer[seqi]; for(v_cnt_i = 0; v_cnt_i < xa_i; v_cnt_i++) { f_i = strlen(cigar_p1s[tid][v_cnt_i]) + 1; seqio[seqi].cigar_p1s[v_cnt_i] = (char* )malloc(f_i); memcpy(seqio[seqi].cigar_p1s[v_cnt_i], cigar_p1s[tid][v_cnt_i], f_i); f_i = strlen(cigar_p2s[tid][v_cnt_i]) + 1; seqio[seqi].cigar_p2s[v_cnt_i] = (char* )malloc(f_i); memcpy(seqio[seqi].cigar_p2s[v_cnt_i], cigar_p2s[tid][v_cnt_i], f_i); } } seqio[seqi].xa_n1 = xa_i1; #ifdef PR_SINGLE if(pr_o_f[tid] == 1) { if(xa_i1 > 0) { memcpy(chr_res1_buffer[seqi], pr_chr_res1[tid], xa_i1); seqio[seqi].chr_res1 = chr_res1_buffer[seqi]; memcpy(xa_ds1_buffer[seqi], pr_xa_d1[tid], xa_i1); seqio[seqi].xa_ds1 = xa_ds1_buffer[seqi]; memcpy(sam_poss1_buffer[seqi], pr_sam_pos1[tid], xa_i1 << 2); seqio[seqi].sam_poss1 = sam_poss1_buffer[seqi]; memcpy(lv_res1_buffer[seqi], pr_lv_re1[tid], xa_i1); seqio[seqi].lv_res1 = lv_res1_buffer[seqi]; } } #endif if(xa_i > 0) { memcpy(xa_d2s_buffer[seqi], xa_d2s[tid], xa_i); seqio[seqi].xa_d2s = xa_d2s_buffer[seqi]; memcpy(sam_pos2s_buffer[seqi], sam_pos2s[tid], xa_i << 2); seqio[seqi].sam_pos2s = sam_pos2s_buffer[seqi]; memcpy(lv_re2s_buffer[seqi], lv_re2s[tid], xa_i << 2); seqio[seqi].lv_re2s = lv_re2s_buffer[seqi]; } seqio[seqi].xa_n2 = xa_i2; #ifdef PR_SINGLE if(pr_o_f[tid] == 1) { if(xa_i2 > 0) { memcpy(chr_res2_buffer[seqi], pr_chr_res2[tid], xa_i2); seqio[seqi].chr_res2 = chr_res2_buffer[seqi]; memcpy(xa_ds2_buffer[seqi], pr_xa_d2[tid], xa_i2); seqio[seqi].xa_ds2 = xa_ds2_buffer[seqi]; memcpy(sam_poss2_buffer[seqi], pr_sam_pos2[tid], xa_i2 << 2); seqio[seqi].sam_poss2 = sam_poss2_buffer[seqi]; memcpy(lv_res2_buffer[seqi], pr_lv_re2[tid], xa_i2); seqio[seqi].lv_res2 = lv_res2_buffer[seqi]; } } #endif } #ifdef PAIR_RANDOM void Adjust(uint32_t* ls, uint32_t s, uint8_t tid) { uint32_t i, t; t = ((s + seedn[tid]) >> 1); while(t > 0) { if(b[tid][s] > b[tid][ls[t]]) { i = s; s = ls[t]; ls[t] = i; } t >>= 1; } ls[0] = s; } void CreateLoserTree(uint32_t* ls, uint8_t tid) { int64_t i; b[tid][seedn[tid]] = MINKEY; for(i = 0; i < seedn[tid]; ++i) { ls[i] = seedn[tid]; } for(i = seedn[tid] - 1; i >= 0; --i) { Adjust(ls, i, tid); } } #ifdef UNPIPATH_OFF_K20 void seed_repetitive_single64(uint64_t* read_bit, uint32_t* pos_n, uint64_t** seedpos, uint8_t tid, uint16_t read_length) #else void seed_repetitive_single(uint64_t* read_bit, uint32_t* pos_n, uint32_t** seedpos, uint8_t tid, uint16_t read_length) #endif { uint8_t re_d = 0; uint8_t b_t_n_r = 0; uint32_t k_i, q, posk_n; uint32_t ref_pos_n = 0; uint32_t uni_offset_s_l = 0; uint16_t read_off = 0; uint32_t posn = 0; uint32_t seed_hash = 0; uint32_t seed_kmer = 0; uint32_t pos_r_ir = 0; uint32_t r_ru = 0; uint32_t ran_p = 0; uint64_t kmer_bit = 0; int64_t seed_id_r = 0; int64_t seed_binary_r = 0; float r_r = 0; #ifdef UNPIPATH_OFF_K20 uint64_t kmer_pos_uni = 0; #else uint32_t kmer_pos_uni = 0; #endif seedn[tid] = 0; //off_start[tid] = 0; seed_l[tid] = pair_ran_intvp; for(read_off = 0; read_off <= read_length - k_t; read_off += seed_l[tid]) { //if(read_off + k_t - 1 <= r_b_v) continue; re_d = (read_off & 0X1f); b_t_n_r = 32 - re_d; #ifdef HASH_KMER_READ_J if(re_d <= re_b) { kmer_bit = ((read_bit[read_off >> 5] & bit_tran_re[re_d]) >> ((re_b - re_d) << 1)); } else { kmer_bit = (((read_bit[read_off >> 5] & bit_tran_re[re_d]) << ((re_d - re_b) << 1)) | (read_bit[(read_off >> 5) + 1] >> ((re_2bt - re_d) << 1))); } #else tran_tmp_p = (read_bit[read_off >> 5] & bit_tran_re[re_d]); //or use this method to deal with: & bit_tran_re[b_t_n_r] kmer_bit = (((read_bit[(read_off >> 5) + 1] >> (b_t_n_r << 1)) & bit_tran_re[b_t_n_r]) | (tran_tmp_p << (re_d << 1))); kmer_bit >>= re_bt; #endif seed_kmer = (kmer_bit & bit_tran[k_r]); seed_hash = (kmer_bit >> (k_r << 1)); //find the kmer #ifdef UNPIPATH_OFF_K20 seed_binary_r = binsearch_offset64(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #else seed_binary_r = binsearch_offset(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #endif if(seed_binary_r == -1) continue; //binary search on unipath offset to get the unipathID kmer_pos_uni = buffer_off_g[seed_binary_r];//this kmer's offset on unipath #ifdef UNPIPATH_OFF_K20 seed_id_r = binsearch_interval_unipath64(kmer_pos_uni, buffer_seqf, result_seqf); #else seed_id_r = binsearch_interval_unipath(kmer_pos_uni, buffer_seqf, result_seqf); #endif ref_pos_n = buffer_pp[seed_id_r + 1] - buffer_pp[seed_id_r]; uni_offset_s_l = kmer_pos_uni - buffer_seqf[seed_id_r]; if(ref_pos_n > pos_n_max) { if(ref_pos_n <= RANDOM_RANGE) { for(pos_r_ir = 0; pos_r_ir < ref_pos_n; pos_r_ir++) seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + pos_r_ir] + uni_offset_s_l - read_off; seed_k_pos[tid][seedn[tid]][pos_r_ir] = MAXKEY; seedn[tid]++; } else { #ifdef PAIR_RANDOM_SEED ran_p = (uint32_t )rand(); r_r = ((float)ref_pos_n / RANDOM_RANGE_MAX); if(r_r >= 2) { r_ru = (uint32_t )r_r; for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE; pos_r_ir++, ran_p++) seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + (pos_r_ir * r_ru) + (random_buffer[ran_p & 0Xfff] % r_ru)] + uni_offset_s_l - read_off; } else { for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE; pos_r_ir++) { seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + (uint32_t )(seed_r_dup[pos_r_ir] * r_r)] + uni_offset_s_l - read_off; } } seed_k_pos[tid][seedn[tid]][pos_r_ir] = MAXKEY; seedn[tid]++; #else r_r = ((float)ref_pos_n / RANDOM_RANGE); for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE; pos_r_ir++) seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + (uint32_t )(pos_r_ir * r_r)] + uni_offset_s_l - read_off; seed_k_pos[tid][seedn[tid]][pos_r_ir] = MAXKEY; seedn[tid]++; #endif } } } posk_n = 0; for(k_i = 0; k_i < seedn[tid]; ++k_i) { b[tid][k_i] = seed_k_pos[tid][k_i][kcol[tid][k_i]++]; } CreateLoserTree(ls[tid], tid); while(b[tid][ls[tid][0]] != MAXKEY) { q = ls[tid][0]; seedposk[tid][posk_n++] = b[tid][q]; if(kcol[tid][q] < MAX_COL) { b[tid][q] = seed_k_pos[tid][q][kcol[tid][q]++]; Adjust(ls[tid],q, tid); } } memset(kcol[tid], 0, seedn[tid] << 2); posn = 1; (*seedpos)[0] = seedposk[tid][0]; for(k_i = 1; k_i < posk_n; k_i++) { if(seedposk[tid][k_i] != seedposk[tid][k_i - 1]) (*seedpos)[posn++] = seedposk[tid][k_i]; } (*pos_n) = posn; } void seed_repetitive(uint8_t tid, uint16_t read_length1, uint16_t read_length2, uint16_t f_cigarn, uint16_t ref_copy_num1, uint16_t ref_copy_num2, uint32_t ref_copy_num_chars1, uint32_t ref_copy_num_chars2, cnt_re* cnt, uint32_t seqi, uint16_t lv_k1, uint16_t lv_k2, int16_t pound_pos1_f_forward, int16_t pound_pos1_f_reverse, int16_t pound_pos1_r_forward, int16_t pound_pos1_r_reverse, int16_t pound_pos2_f_forward, int16_t pound_pos2_f_reverse, int16_t pound_pos2_r_forward, int16_t pound_pos2_r_reverse) { uint8_t rc_i = 0; uint8_t rc_ii = 0; uint8_t re_d = 0; uint8_t b_t_n_r = 0; uint8_t q_n1 = 0; uint8_t c_m_f = 0; uint8_t max_mismatch = 0; uint16_t rst_i = 0; uint16_t s_m_t = 0; uint16_t read_b_i = 0; uint16_t ref_copy_num = 0; uint16_t end_dis[2]; uint16_t read_length = 0; int bit_char_i = 0; int dm1 = 0; int dmt1 = 0; int lv_dmt1 = 0; int dm12 = 0; int dm_l1 = 0; int dm_r1 = 0; int ld1 = 0; int rd1 = 0; int ld2 = 0; int rd2 = 0; int s_r_o_l1 = 0; int s_r_o_r1 = 0; int cmp_re = 0; int q_rear_i = 0; int q_rear1 = 0; int cache_dml1[MAX_Q_NUM]; int cache_dmr1[MAX_Q_NUM]; int cache_dis1[MAX_Q_NUM]; uint32_t ref_copy_num_chars = 0; uint32_t ref_copy_num_chars_1 = 0; uint32_t ref_copy_num_chars_2 = 0; uint32_t pos1_t = 0; uint32_t pos2_t = 0; uint32_t seed_nt = 0; uint32_t seed_nt1 = 0; uint32_t seed_nt2 = 0; uint32_t inner_n = 0; uint32_t seed_sn = 0; uint32_t seednn[2]; uint32_t mis_c_n = 0; uint32_t mis_c_n_filt = 0; int64_t b_r_s = 0; int64_t b_r_s_i = 0; uint64_t tran_tmp_p = 0; uint64_t tran_tmp = 0; uint64_t xor_tmp = 0; uint64_t ref_tmp_ori = 0; uint64_t ref_tmp_ori2 = 0; uint64_t cache_end1[MAX_Q_NUM][MAX_REF_SEQ_C]; uint64_t low_mask = 0; uint16_t* sub_mask = NULL; uint64_t* ex_d_mask = NULL; dm_op[tid] = MAX_OP_SCORE; dm_ops[tid] = MAX_OP_SCORE; cnt->v_cnt = 0; cnt->vs_cnt = 0; #ifdef QUAL_FILT_REP uint64_t* qual_filt_1 = NULL; #endif #ifdef PR_SINGLE min_mis[tid] = 0Xff; seedpos_misn[0][0][tid] = 0; seedpos_misn[0][1][tid] = 0; seedpos_misn[1][0][tid] = 0; seedpos_misn[1][1][tid] = 0; #endif #ifdef UNPIPATH_OFF_K20 uint64_t pos_l = 0; uint64_t pos_t1 = 0; uint64_t pos_t2 = 0; uint64_t posi = 0; uint64_t up_pos = 0; uint64_t down_pos = 0; uint64_t* seed_pt = NULL; #else uint32_t pos_l = 0; uint32_t pos_t1 = 0; uint32_t pos_t2 = 0; uint32_t posi = 0; uint32_t up_pos = 0; uint32_t down_pos = 0; uint32_t* seed_pt = NULL; #endif end_dis[0] = end_dis1[tid]; end_dis[1] = end_dis2[tid]; for(rc_i = 0; rc_i < 2; rc_i++) { //check whether can make pair if((pos_ren[rc_i][0][tid] == 0) || (pos_ren[rc_i][1][tid] == 0)) continue; #ifdef UNPIPATH_OFF_K20 seed_repetitive_single64(read_bit1[tid][rc_i], &(seed_posn[rc_i][tid]), &(seedpos[rc_i][rc_i][tid]), tid, read_length1); seed_repetitive_single64(read_bit2[tid][1 - rc_i], &(seed_posn[1 - rc_i][tid]), &(seedpos[rc_i][1 - rc_i][tid]), tid, read_length2); #else seed_repetitive_single(read_bit1[tid][rc_i], &(seed_posn[rc_i][tid]), &(seedpos[rc_i][rc_i][tid]), tid, read_length1); seed_repetitive_single(read_bit2[tid][1 - rc_i], &(seed_posn[1 - rc_i][tid]), &(seedpos[rc_i][1 - rc_i][tid]), tid, read_length2); #endif seed_nt1 = seed_posn[0][tid]; seed_nt2 = seed_posn[1][tid]; if((seed_nt1 == 0) || (seed_nt2 == 0)) continue; #ifdef PR_SINGLE //do exact match to get mismatch number on every position in seedpos for(rc_ii = 0; rc_ii < 2; rc_ii++) { if(rc_i == rc_ii) { ref_copy_num_chars = ref_copy_num_chars1; ref_copy_num = ref_copy_num1; low_mask = low_mask1[tid]; sub_mask = sub_mask1[tid]; ex_d_mask = ex_d_mask1[tid]; max_mismatch = max_mismatch1[tid]; #ifdef QUAL_FILT_REP if(rc_i == 0) qual_filt_1 = qual_filt1[tid][0]; else qual_filt_1 = qual_filt1[tid][1]; #endif } else { ref_copy_num_chars = ref_copy_num_chars2; ref_copy_num = ref_copy_num2; low_mask = low_mask2[tid]; sub_mask = sub_mask2[tid]; ex_d_mask = ex_d_mask2[tid]; max_mismatch = max_mismatch2[tid]; #ifdef QUAL_FILT_REP if(rc_i == 0) qual_filt_1 = qual_filt2[tid][1]; else qual_filt_1 = qual_filt2[tid][0]; #endif } read_bit_1[tid] = read_bit_pr[tid][(rc_i << 1) + rc_ii]; for(pos1_t = 0; pos1_t < seed_posn[rc_ii][tid]; pos1_t++) { pos_l = seedpos[rc_i][rc_ii][tid][pos1_t] - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars); for(rst_i = 0; rst_i < ref_copy_num - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num - 1] &= low_mask; } //trim the beginning and end of the current ref seq based on current minimum edit distance dm_t s_m_t = sub_mask[0]; ref_seq_tmp1[tid][0] &= bit_tran[0]; ref_seq_tmp1[tid][s_m_t] &= ex_d_mask[0]; mis_c_n = 0; #ifdef QUAL_FILT_REP mis_c_n_filt = 0; #endif //ref_tmp_ori = ref_seq_tmp1[ref_copy_num - 2]; ref_seq_tmp1[tid][ref_copy_num - 2] &= low_mask; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT_REP mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch) break; #endif } if(mis_c_n_filt > max_mismatch) { seedpos_mis[rc_i][rc_ii][tid][pos1_t] = MAX_SPM; } else { seedpos_mis[rc_i][rc_ii][tid][pos1_t] = mis_c_n; if(mis_c_n < min_mis[tid]) min_mis[tid] = mis_c_n; } } seedpos_misn[rc_i][rc_ii][tid] = seed_posn[rc_ii][tid]; } #endif memset(seed_posf[0][tid], 0, seed_nt1); memset(seed_posf[1][tid], 0, seed_nt2); for(pos1_t = 0, pos2_t = 0; (pos1_t < seed_nt1) && (pos2_t < seed_nt2); pos1_t++) { up_pos = seedpos[rc_i][0][tid][pos1_t] + end_dis[rc_i] - devi; down_pos = seedpos[rc_i][0][tid][pos1_t] + end_dis[rc_i] + devi; seed_pt = seedpos[rc_i][1][tid]; inner_n = 0; for( ; (seed_pt[pos2_t] < down_pos) && (pos2_t < seed_nt2); pos2_t++) if(seed_pt[pos2_t] > up_pos) { seed_posf[1][tid][pos2_t] = 1; inner_n++; } if(inner_n > 0) seed_posf[0][tid][pos1_t] = 1; } for(pos1_t = 0, pos2_t = 0; (pos1_t < seed_nt1) && (pos2_t < seed_nt2); pos2_t++) { up_pos = seedpos[rc_i][1][tid][pos2_t] - end_dis[rc_i] - devi; down_pos = seedpos[rc_i][1][tid][pos2_t] - end_dis[rc_i] + devi; seed_pt = seedpos[rc_i][0][tid]; inner_n = 0; for( ; (seed_pt[pos1_t] < down_pos) && (pos1_t < seed_nt2); pos1_t++) if(seed_pt[pos1_t] > up_pos) { seed_posf[0][tid][pos1_t] = 1; inner_n++; } if(inner_n > 0) seed_posf[1][tid][pos2_t] = 1; } for(rc_ii = 0; rc_ii < 2; rc_ii++) { if(rc_i == rc_ii) { ref_copy_num_chars = ref_copy_num_chars1; ref_copy_num = ref_copy_num1; low_mask = low_mask1[tid]; sub_mask = sub_mask1[tid]; ex_d_mask = ex_d_mask1[tid]; lv_dmt1 = lv_k1; read_length = read_length1; max_mismatch = max_mismatch1[tid]; #ifdef QUAL_FILT_REP if(rc_i == 0) qual_filt_1 = qual_filt1[tid][0]; else qual_filt_1 = qual_filt1[tid][1]; #endif } else { ref_copy_num_chars = ref_copy_num_chars2; ref_copy_num = ref_copy_num2; low_mask = low_mask2[tid]; sub_mask = sub_mask2[tid]; ex_d_mask = ex_d_mask2[tid]; lv_dmt1 = lv_k2; read_length = read_length2; max_mismatch = max_mismatch2[tid]; #ifdef QUAL_FILT_REP if(rc_i == 0) qual_filt_1 = qual_filt2[tid][1]; else qual_filt_1 = qual_filt2[tid][0]; #endif } read_bit_1[tid] = read_bit_pr[tid][(rc_i << 1) + rc_ii]; read_val_1[tid] = read_val_pr[tid][(rc_i << 1) + rc_ii]; q_rear1 = 0; q_n1 = 0; dmt1 = ali_exl; s_r_o_l1 = 0; s_r_o_r1 = 0; seed_sn = 0; for(pos1_t = 0; pos1_t < seed_posn[rc_ii][tid]; pos1_t++) { if(seed_posf[rc_ii][tid][pos1_t] == 1) { #ifdef PR_SINGLE if(seedpos_mis[rc_i][rc_ii][tid][pos1_t] == MAX_SPM) { #endif //lv_f1 = 0; pos_l = seedpos[rc_i][rc_ii][tid][pos1_t] - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars); for(rst_i = 0; rst_i < ref_copy_num - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num - 1] &= low_mask; } //trim the beginning and end of the current ref seq based on current minimum edit distance dm_t s_m_t = sub_mask[dmt1]; ref_seq_tmp1[tid][0] &= bit_tran[dmt1]; ref_seq_tmp1[tid][s_m_t] &= ex_d_mask[dmt1]; //traverse and check whether there is an existing seq that is as same as current new ref seq c_m_f = 0; for(q_rear_i = q_rear1 - 1; q_rear_i >= 0; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask[dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; c_m_f = 1; break; } } if((q_n1 > MAX_Q_NUM) && (q_rear_i < 0)) { for(q_rear_i = MAX_Q_NUM - 1; q_rear_i >= q_rear1; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask[dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; c_m_f = 1; break; } } } //do not find the seq in cache, exact match or lv and add into cache if(c_m_f == 0) { #ifdef PR_SINGLE mis_c_n = max_mismatch + 1; #else //exact match mis_c_n = 0; #ifdef QUAL_FILT_REP mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num - 2]; ref_seq_tmp1[tid][ref_copy_num - 2] &= low_mask; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT_REP mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch) break; #endif } ref_seq_tmp1[tid][ref_copy_num - 2] = ref_tmp_ori; #endif //lv if(mis_c_n_filt > max_mismatch) { #ifdef SPLIT_LV //split lv for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - bit_char_i) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - bit_char_i) << 1)) & 0X3); #ifdef LV_CIGAR dm_l1 = computeEditDistanceWithCigar(ali_ref_seq[tid], 33 + s_r_o_l1, read_char[tid], s_r_o_l1 + 1, dmt1, cigarBuf, f_cigarn, 0, 0, L[tid]); #else dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + s_r_o_l1, read_char[tid], s_r_o_l1 + 1, lv_dmt1, L[tid]); #endif for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - bit_char_i) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - bit_char_i) << 1)) & 0X3); #ifdef LV_CIGAR dm_r1 = computeEditDistanceWithCigar(ali_ref_seq[tid], 32 + read_length - s_r_o_r1, read_char[tid], read_length - s_r_o_r1, dmt1, cigarBuf, f_cigarn, 0, 0, L[tid]); #else dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + read_length - s_r_o_r1, read_char[tid], read_length - s_r_o_r1, lv_dmt1, L[tid]); #endif dm1 = dm_l1 + dm_r1; ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { dm1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch - 1) dmt1 = 0; } else dm1 = MAX_EDIT_SCORE; //add the ref sequence at the end of queue memcpy(cache_end1[q_rear1], ref_seq_tmp1[tid], ref_copy_num_chars); cache_dis1[q_rear1] = dm1; cache_dml1[q_rear1] = ld1; cache_dmr1[q_rear1] = rd1; q_rear1 = ((q_rear1 + 1) & 0X1f); ++q_n1; //add edit distance } if(dm1 != MAX_EDIT_SCORE) { seed_single_pos[rc_ii][tid][seed_sn] = seedpos[rc_i][rc_ii][tid][pos1_t]; seed_single_ld[rc_ii][tid][seed_sn] = ld1; seed_single_rd[rc_ii][tid][seed_sn] = rd1; seed_single_dm[rc_ii][tid][seed_sn] = dm1; memcpy(seed_single_refs[rc_ii][tid][seed_sn], ref_seq_tmp1[tid], ref_copy_num_chars); seed_sn++; } #ifdef PR_SINGLE } else { seed_single_pos[rc_ii][tid][seed_sn] = seedpos[rc_i][rc_ii][tid][pos1_t]; seed_single_ld[rc_ii][tid][seed_sn] = 0; seed_single_rd[rc_ii][tid][seed_sn] = 0; seed_single_dm[rc_ii][tid][seed_sn] = seedpos_mis[rc_i][rc_ii][tid][pos1_t]; seed_sn++; } #endif } } seednn[rc_ii] = seed_sn; } if((seednn[0] == 0) || (seednn[1] == 0)) continue; if(rc_i == 0) { ref_copy_num_chars_1 = ref_copy_num_chars1; ref_copy_num_chars_2 = ref_copy_num_chars2; } else { ref_copy_num_chars_1 = ref_copy_num_chars2; ref_copy_num_chars_2 = ref_copy_num_chars1; } if(seednn[0] <= seednn[1]) { for(pos1_t = 0; pos1_t < seednn[0]; pos1_t++) { pos_t1 = seed_single_pos[0][tid][pos1_t]; posi = pos_t1 + end_dis[rc_i]; #ifdef UNPIPATH_OFF_K20 b_r_s = binsearch_seed_pos_ss64(posi, seed_single_pos[1][tid], seednn[1]); #else b_r_s = binsearch_seed_pos_ss(posi, seed_single_pos[1][tid], seednn[1]); #endif if(b_r_s != -1) { dm12 = seed_single_dm[0][tid][pos1_t] + seed_single_dm[1][tid][b_r_s]; pos_t2 = seed_single_pos[1][tid][b_r_s]; ld1 = seed_single_ld[0][tid][pos1_t]; ld2 = seed_single_ld[1][tid][b_r_s]; rd1 = seed_single_rd[0][tid][pos1_t]; rd2 = seed_single_rd[1][tid][b_r_s]; memcpy(ref_seq_tmp1[tid], seed_single_refs[0][tid][pos1_t], ref_copy_num_chars_1); memcpy(ref_seq_tmp2[tid], seed_single_refs[1][tid][b_r_s], ref_copy_num_chars_2); #ifdef UNPIPATH_OFF_K20 cnt = pair_op_add64(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][pos1_t], seed_single_dm[1][tid][b_r_s], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #else cnt = pair_op_add(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][pos1_t], seed_single_dm[1][tid][b_r_s], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #endif #ifdef PAIR_TRAVERSE for(b_r_s_i = b_r_s + 1; (seed_single_pos[1][tid][b_r_s_i] < posi + devi) && (b_r_s_i < seednn[1]); b_r_s_i++) { dm12 = seed_single_dm[0][tid][pos1_t] + seed_single_dm[1][tid][b_r_s_i]; pos_t2 = seed_single_pos[1][tid][b_r_s_i]; ld2 = seed_single_ld[1][tid][b_r_s_i]; rd2 = seed_single_rd[1][tid][b_r_s_i]; memcpy(ref_seq_tmp2[tid], seed_single_refs[1][tid][b_r_s_i], ref_copy_num_chars_2); #ifdef UNPIPATH_OFF_K20 cnt = pair_op_add64(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][pos1_t], seed_single_dm[1][tid][b_r_s_i], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #else cnt = pair_op_add(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][pos1_t], seed_single_dm[1][tid][b_r_s_i], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #endif } for(b_r_s_i = b_r_s - 1; (seed_single_pos[1][tid][b_r_s_i] > posi - devi) && (b_r_s_i >= 0); b_r_s_i--) { dm12 = seed_single_dm[0][tid][pos1_t] + seed_single_dm[1][tid][b_r_s_i]; pos_t2 = seed_single_pos[1][tid][b_r_s_i]; ld2 = seed_single_ld[1][tid][b_r_s_i]; rd2 = seed_single_rd[1][tid][b_r_s_i]; memcpy(ref_seq_tmp2[tid], seed_single_refs[1][tid][b_r_s_i], ref_copy_num_chars_2); #ifdef UNPIPATH_OFF_K20 cnt = pair_op_add64(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][pos1_t], seed_single_dm[1][tid][b_r_s_i], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #else cnt = pair_op_add(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][pos1_t], seed_single_dm[1][tid][b_r_s_i], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #endif } #endif } } } else { for(pos2_t = 0; pos2_t < seednn[1]; pos2_t++) { pos_t2 = seed_single_pos[1][tid][pos2_t]; posi = pos_t2 - end_dis[rc_i]; #ifdef UNPIPATH_OFF_K20 b_r_s = binsearch_seed_pos_ss64(posi, seed_single_pos[0][tid], seednn[0]); #else b_r_s = binsearch_seed_pos_ss(posi, seed_single_pos[0][tid], seednn[0]); #endif if(b_r_s != -1) { dm12 = seed_single_dm[1][tid][pos2_t] + seed_single_dm[0][tid][b_r_s]; pos_t1 = seed_single_pos[0][tid][b_r_s]; ld1 = seed_single_ld[0][tid][b_r_s]; ld2 = seed_single_ld[1][tid][pos2_t]; rd1 = seed_single_rd[0][tid][b_r_s]; rd2 = seed_single_rd[1][tid][pos2_t]; memcpy(ref_seq_tmp1[tid], seed_single_refs[0][tid][b_r_s], ref_copy_num_chars_1); memcpy(ref_seq_tmp2[tid], seed_single_refs[1][tid][pos2_t], ref_copy_num_chars_2); #ifdef UNPIPATH_OFF_K20 cnt = pair_op_add64(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][b_r_s], seed_single_dm[1][tid][pos2_t],tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #else cnt = pair_op_add(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][b_r_s], seed_single_dm[1][tid][pos2_t],tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #endif #ifdef PAIR_TRAVERSE for(b_r_s_i = b_r_s + 1; (seed_single_pos[0][tid][b_r_s_i] < posi + devi) && (b_r_s_i < seednn[0]); b_r_s_i++) { dm12 = seed_single_dm[1][tid][pos2_t] + seed_single_dm[0][tid][b_r_s_i]; pos_t1 = seed_single_pos[0][tid][b_r_s_i]; ld1 = seed_single_ld[0][tid][b_r_s_i]; rd1 = seed_single_rd[0][tid][b_r_s_i]; memcpy(ref_seq_tmp1[tid], seed_single_refs[0][tid][b_r_s_i], ref_copy_num_chars_1); #ifdef UNPIPATH_OFF_K20 cnt = pair_op_add64(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][b_r_s_i], seed_single_dm[1][tid][pos2_t], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #else cnt = pair_op_add(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][b_r_s_i], seed_single_dm[1][tid][pos2_t], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #endif } for(b_r_s_i = b_r_s - 1; (seed_single_pos[0][tid][b_r_s_i] > posi - devi) && (b_r_s_i >= 0); b_r_s_i--) { dm12 = seed_single_dm[1][tid][pos2_t] + seed_single_dm[0][tid][b_r_s_i]; pos_t1 = seed_single_pos[0][tid][b_r_s_i]; ld1 = seed_single_ld[0][tid][b_r_s_i]; rd1 = seed_single_rd[0][tid][b_r_s_i]; memcpy(ref_seq_tmp1[tid], seed_single_refs[0][tid][b_r_s_i], ref_copy_num_chars_1); #ifdef UNPIPATH_OFF_K20 cnt = pair_op_add64(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][b_r_s_i], seed_single_dm[1][tid][pos2_t], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #else cnt = pair_op_add(pos_t1, pos_t2, ld1, rd1, ld2, rd2, dm12, rc_i, seed_single_dm[0][tid][b_r_s_i], seed_single_dm[1][tid][pos2_t], tid, ref_copy_num_chars1, ref_copy_num_chars2, cnt); #endif } #endif } } } } if(cnt->v_cnt > 0) { de_m_p_o[tid] = 0; #ifdef ALI_OUT #ifdef PR_SINGLE pr_o_f[tid] = 1; #endif pair_sam_output(tid, read_length1, read_length2, f_cigarn, cnt, seqi, lv_k1, lv_k2, pound_pos1_f_forward, pound_pos1_f_reverse, pound_pos1_r_forward, pound_pos1_r_reverse, pound_pos2_f_forward, pound_pos2_f_reverse, pound_pos2_r_forward, pound_pos2_r_reverse, cir_fix_n - 1); #endif } } #ifdef UNPIPATH_OFF_K20 cnt_re* pair_op_add64(uint64_t pos_t1, uint64_t pos_t2, int ld1, int rd1, int ld2, int rd2, int dm12, uint8_t rc_i, int dm1, int dm2, uint8_t tid, uint32_t ref_copy_num_chars1, uint32_t ref_copy_num_chars2, cnt_re* cnt) #else cnt_re* pair_op_add(uint32_t pos_t1, uint32_t pos_t2, int ld1, int rd1, int ld2, int rd2, int dm12, uint8_t rc_i, int dm1, int dm2, uint8_t tid, uint32_t ref_copy_num_chars1, uint32_t ref_copy_num_chars2, cnt_re* cnt) #endif { uint16_t dm_i = 0; uint32_t v_cnt = 0; uint32_t vs_cnt = 0; v_cnt = cnt->v_cnt; vs_cnt = cnt->vs_cnt; if(dm12 < dm_op[tid]) { #ifdef DM_COPY_REP for(dm_i = 0; dm_i < v_cnt; dm_i++) { ops_vector_pos1[tid][dm_i] = op_vector_pos1[tid][dm_i]; ops_dm_l1[tid][dm_i] = op_dm_l1[tid][dm_i]; ops_dm_r1[tid][dm_i] = op_dm_r1[tid][dm_i]; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars1); #else if(!((op_dm_l1[tid][dm_i] == 0) && (op_dm_r1[tid][dm_i] == 0))) memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars1); #endif ops_dm_ex1[tid][dm_i] = op_dm_ex1[tid][dm_i]; ops_vector_pos2[tid][dm_i] = op_vector_pos2[tid][dm_i]; ops_dm_l2[tid][dm_i] = op_dm_l2[tid][dm_i]; ops_dm_r2[tid][dm_i] = op_dm_r2[tid][dm_i]; if(!((op_dm_l2[tid][dm_i] == 0) && (op_dm_r2[tid][dm_i] == 0))) memcpy(ops_vector_seq2[tid][dm_i], op_vector_seq2[tid][dm_i], ref_copy_num_chars2); ops_dm_ex2[tid][dm_i] = op_dm_ex2[tid][dm_i]; } vs_cnt = v_cnt; dm_ops[tid] = dm_op[tid]; #endif v_cnt = 0; if(rc_i == 0) { op_vector_pos1[tid][v_cnt] = pos_t1; op_vector_pos2[tid][v_cnt] = pos_t2; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; op_dm_l2[tid][v_cnt] = ld2; op_dm_r2[tid][v_cnt] = rd2; op_dm_ex1[tid][v_cnt] = dm1; op_dm_ex2[tid][v_cnt] = dm2; } else { op_vector_pos1[tid][v_cnt] = pos_t2; op_vector_pos2[tid][v_cnt] = pos_t1; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld2; op_dm_r1[tid][v_cnt] = rd2; op_dm_l2[tid][v_cnt] = ld1; op_dm_r2[tid][v_cnt] = rd1; op_dm_ex1[tid][v_cnt] = dm2; op_dm_ex2[tid][v_cnt] = dm1; } op_rc[tid][v_cnt] = rc_i; ++v_cnt; dm_op[tid] = dm12; } else if(dm12 == dm_op[tid]) { if(v_cnt < cus_max_output_ali) { if(rc_i == 0) { op_vector_pos1[tid][v_cnt] = pos_t1; op_vector_pos2[tid][v_cnt] = pos_t2; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; op_dm_l2[tid][v_cnt] = ld2; op_dm_r2[tid][v_cnt] = rd2; op_dm_ex1[tid][v_cnt] = dm1; op_dm_ex2[tid][v_cnt] = dm2; } else { op_vector_pos1[tid][v_cnt] = pos_t2; op_vector_pos2[tid][v_cnt] = pos_t1; #ifdef MAPPING_QUALITY memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq2[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif op_dm_l1[tid][v_cnt] = ld2; op_dm_r1[tid][v_cnt] = rd2; op_dm_l2[tid][v_cnt] = ld1; op_dm_r2[tid][v_cnt] = rd1; op_dm_ex1[tid][v_cnt] = dm2; op_dm_ex2[tid][v_cnt] = dm1; } op_rc[tid][v_cnt] = rc_i; ++v_cnt; } } else if(dm12 < dm_ops[tid]) { vs_cnt = 0; if(rc_i == 0) { ops_vector_pos1[tid][vs_cnt] = pos_t1; ops_vector_pos2[tid][vs_cnt] = pos_t2; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; ops_dm_l2[tid][vs_cnt] = ld2; ops_dm_r2[tid][vs_cnt] = rd2; ops_dm_ex1[tid][vs_cnt] = dm1; ops_dm_ex2[tid][vs_cnt] = dm2; } else { ops_vector_pos1[tid][vs_cnt] = pos_t2; ops_vector_pos2[tid][vs_cnt] = pos_t1; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld2; ops_dm_r1[tid][vs_cnt] = rd2; ops_dm_l2[tid][vs_cnt] = ld1; ops_dm_r2[tid][vs_cnt] = rd1; ops_dm_ex1[tid][vs_cnt] = dm2; ops_dm_ex2[tid][vs_cnt] = dm1; } ops_rc[tid][vs_cnt] = rc_i; ++vs_cnt; dm_ops[tid] = dm12; } else if(dm12 == dm_ops[tid]) { if(vs_cnt < cus_max_output_ali) { if(rc_i == 0) { ops_vector_pos1[tid][vs_cnt] = pos_t1; ops_vector_pos2[tid][vs_cnt] = pos_t2; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars1); if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; ops_dm_l2[tid][vs_cnt] = ld2; ops_dm_r2[tid][vs_cnt] = rd2; ops_dm_ex1[tid][vs_cnt] = dm1; ops_dm_ex2[tid][vs_cnt] = dm2; } else { ops_vector_pos1[tid][vs_cnt] = pos_t2; ops_vector_pos2[tid][vs_cnt] = pos_t1; #ifdef MAPPING_QUALITY memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #else if(!((ld2 == 0) && (rd2 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp2[tid], ref_copy_num_chars1); if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq2[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars2); #endif ops_dm_l1[tid][vs_cnt] = ld2; ops_dm_r1[tid][vs_cnt] = rd2; ops_dm_l2[tid][vs_cnt] = ld1; ops_dm_r2[tid][vs_cnt] = rd1; ops_dm_ex1[tid][vs_cnt] = dm2; ops_dm_ex2[tid][vs_cnt] = dm1; } ops_rc[tid][vs_cnt] = rc_i; ++vs_cnt; } } cnt->v_cnt = v_cnt; cnt->vs_cnt = vs_cnt; return cnt; } void seed_repetitive_single_end(uint64_t* read_bit, uint8_t tid, uint16_t read_length) { uint8_t re_d = 0; uint8_t b_t_n_r = 0; uint32_t ref_pos_n = 0; uint32_t uni_offset_s_l = 0; uint32_t uni_offset_s_r = 0; uint16_t read_off = 0; uint16_t left_i = 1; uint16_t right_i = 1; uint16_t r_b_v = 0; uint32_t seed_hash = 0; uint32_t seed_kmer = 0; uint32_t pos_r_ir = 0; uint32_t r_ru = 0; uint32_t ran_p = 0; uint64_t kmer_bit = 0; int64_t seed_id_r = 0; int64_t seed_binary_r = 0; float r_r = 0; #ifdef UNPIPATH_OFF_K20 uint64_t kmer_pos_uni = 0; #else uint32_t kmer_pos_uni = 0; #endif r_b_v = 0; seedn[tid] = 0; seed_l[tid] = pair_ran_intvp; for(read_off = 0; read_off <= read_length - k_t; read_off += seed_l[tid]) { if(read_off + k_t - 1 <= r_b_v) continue; re_d = (read_off & 0X1f); b_t_n_r = 32 - re_d; #ifdef HASH_KMER_READ_J if(re_d <= re_b) { kmer_bit = ((read_bit[read_off >> 5] & bit_tran_re[re_d]) >> ((re_b - re_d) << 1)); } else { kmer_bit = (((read_bit[read_off >> 5] & bit_tran_re[re_d]) << ((re_d - re_b) << 1)) | (read_bit[(read_off >> 5) + 1] >> ((re_2bt - re_d) << 1))); } #else tran_tmp_p = (read_bit[read_off >> 5] & bit_tran_re[re_d]); //or use this method to deal with: & bit_tran_re[b_t_n_r] kmer_bit = (((read_bit[(read_off >> 5) + 1] >> (b_t_n_r << 1)) & bit_tran_re[b_t_n_r]) | (tran_tmp_p << (re_d << 1))); kmer_bit >>= re_bt; #endif seed_kmer = (kmer_bit & bit_tran[k_r]); seed_hash = (kmer_bit >> (k_r << 1)); //find the kmer #ifdef UNPIPATH_OFF_K20 seed_binary_r = binsearch_offset64(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #else seed_binary_r = binsearch_offset(seed_kmer, buffer_kmer_g, buffer_hash_g[seed_hash + 1] - buffer_hash_g[seed_hash], buffer_hash_g[seed_hash]); #endif if(seed_binary_r == -1) continue; //binary search on unipath offset to get the unipathID kmer_pos_uni = buffer_off_g[seed_binary_r];//this kmer's offset on unipath #ifdef UNPIPATH_OFF_K20 seed_id_r = binsearch_interval_unipath64(kmer_pos_uni, buffer_seqf, result_seqf); #else seed_id_r = binsearch_interval_unipath(kmer_pos_uni, buffer_seqf, result_seqf); #endif ref_pos_n = buffer_pp[seed_id_r + 1] - buffer_pp[seed_id_r]; uni_offset_s_l = kmer_pos_uni - buffer_seqf[seed_id_r]; uni_offset_s_r = buffer_seqf[seed_id_r + 1] - (kmer_pos_uni + k_t); if(ref_pos_n > pos_n_max) { if(ref_pos_n <= RANDOM_RANGE) { for(pos_r_ir = 0; pos_r_ir < ref_pos_n; pos_r_ir++) seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + pos_r_ir] + uni_offset_s_l - read_off; seed_k_pos[tid][seedn[tid]][pos_r_ir] = MAXKEY; ++seedn[tid]; } else { #ifdef PAIR_RANDOM_SEED ran_p = (uint32_t )rand(); r_r = ((float)ref_pos_n / RANDOM_RANGE_MAX); if(r_r >= 2) { r_ru = (uint32_t )r_r; for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE; pos_r_ir++, ran_p++) seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + (pos_r_ir * r_ru) + (random_buffer[ran_p & 0Xfff] % r_ru)] + uni_offset_s_l - read_off; } else { for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE; pos_r_ir++) { seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + (uint32_t )(seed_r_dup[pos_r_ir] * r_r)] + uni_offset_s_l - read_off; } } seed_k_pos[tid][seedn[tid]][pos_r_ir] = MAXKEY; ++seedn[tid]; #else r_r = ((float)ref_pos_n / RANDOM_RANGE); for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE; pos_r_ir++) seed_k_pos[tid][seedn[tid]][pos_r_ir] = buffer_p[buffer_pp[seed_id_r] + (uint32_t )(pos_r_ir * r_r)] + uni_offset_s_l - read_off; seed_k_pos[tid][seedn[tid]][pos_r_ir] = MAXKEY; ++seedn[tid]; #endif } for(left_i = 1; (left_i <= uni_offset_s_l) && (left_i <= read_off); left_i++) { #ifdef UNI_SEQ64 if(((buffer_seq[(kmer_pos_uni - left_i) >> 5] >> ((31 - ((kmer_pos_uni - left_i) & 0X1f)) << 1)) & 0X3) != ((read_bit[(read_off - left_i) >> 5] >> ((31 - ((read_off - left_i) & 0X1f)) << 1)) & 0X3) ) break; #else if(((buffer_seq[(kmer_pos_uni - left_i) >> 2] >> (((kmer_pos_uni - left_i) & 0X3) << 1)) & 0X3) != ((read_bit[(read_off - left_i) >> 5] >> ((31 - ((read_off - left_i) & 0X1f)) << 1)) & 0X3) ) break; #endif } for(right_i = 1; (right_i <= uni_offset_s_r) && (right_i <= read_length - read_off - k_t); right_i++) { #ifdef UNI_SEQ64 if(((buffer_seq[(kmer_pos_uni + k_t - 1 + right_i) >> 5] >> ((31 - ((kmer_pos_uni + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) != ((read_bit[(read_off + k_t - 1 + right_i) >> 5] >> ((31 - ((read_off + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) ) break; #else if(((buffer_seq[(kmer_pos_uni + k_t - 1 + right_i) >> 2] >> (((kmer_pos_uni + k_t - 1 + right_i) & 0X3) << 1)) & 0X3) != ((read_bit[(read_off + k_t - 1 + right_i) >> 5] >> ((31 - ((read_off + k_t - 1 + right_i) & 0X1f)) << 1)) & 0X3) ) break; #endif } left_dis[tid][seedn[tid] - 1] = read_off - left_i; right_dis[tid][seedn[tid] - 1] = read_off + k_t + right_i - 1; r_b_v = read_off + k_t + right_i - 1; } } } #endif int seed_ali_single_end(int argc, char *argv[]) { fprintf(stderr, "single end reads mapping\n\n"); double t = 0.00; clock_t start = 0, end = 0; uint16_t v_cnt_i = 0; uint32_t r_i = 0; uint32_t seqi = 0; uint32_t seqii = 0; int64_t kr1 = 0; int32_t m = 0; uint16_t read_length_tmp = 0; #ifdef PAIR_RANDOM_SEED uint32_t r_dup_i = 0; int pos_r_nr = 0; uint32_t pos_r_ir = 0; #endif char h_chars[6]; uint32_t read_in = 0X10000; uint8_t readlen_name = 255; start = clock(); load_index_file(); end = clock(); t = (double)(end - start) / CLOCKS_PER_SEC; seed_l_max = seed_step * cir_fix_n; fprintf(stderr, "%lf seconds is used for loading index\n", t); fp1 = gzopen(read_fastq1, "r"); seq1 = kseq_init(fp1); if(fp1 == NULL) { fprintf(stderr, "wrong input file route or name: %s\n", read_fastq1); exit(1); } if(flag_std == 0) { fp_sam = fopen(sam_result, "w"); if(fp_sam == NULL) { fprintf(stderr, "wrong output file route or name: %s\n", sam_result); exit(1); } } k_r = k_t - k; re_b = 32 - k_t; re_bt = (re_b << 1); re_2bt = 64 - k_t; fprintf(stderr, "number of threads running: %u\nmax read length: %u\nseed positions filter: %u\nthe filter number of seed positions: %u\nthe minimum seed interval: %u\nthe number of seed circulation: %u\n", thread_n, readlen_max, pos_n_max, seed_filter_pos_num_singlen, seed_step, cir_fix_n); pair_ran_intvp = seed_l_max; #ifdef SEED_FILTER_POS seed_filter_pos_num_single = seed_filter_pos_num_singlen >> 1; #endif //should allocate at beginning seed_num = ((readlen_max - k_t) / seed_l_l) + 1; new_seed_cnt = seed_num * pos_n_max; uint16_t cigar_max_n = MAX_LV_CIGARCOM; start = clock(); #ifdef PTHREAD_USE g_low = (int64_t* )calloc(thread_n, 8); r_low = (int64_t* )calloc(thread_n, 8); seedm = (seed_m** )calloc(thread_n, sizeof(seed_m* )); for(r_i = 0; r_i < thread_n; r_i++) seedm[r_i] = (seed_m* )calloc(seed_num, sizeof(seed_m)); seedu = (seed_m** )calloc(thread_n, sizeof(seed_m* )); for(r_i = 0; r_i < thread_n; r_i++) seedu[r_i] = (seed_m* )calloc(seed_num, sizeof(seed_m)); seedsets = (seed_sets** )calloc(thread_n, sizeof(seed_sets* )); for(r_i = 0; r_i < thread_n; r_i++) seedsets[r_i] = (seed_sets* )calloc(new_seed_cnt, sizeof(seed_sets)); seed_set_off = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_off[r_i] = (uint32_t* )calloc(new_seed_cnt, sizeof(uint32_t )); #ifdef SINGLE_PAIR cov_num_front_single = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); cov_num_re_single = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); #endif #ifdef UNPIPATH_OFF_K20 seed_set_pos_single = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos_single[r_i] = (uint64_t* )calloc(new_seed_cnt << 1, 8); #else seed_set_pos_single = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) seed_set_pos_single[r_i] = (uint32_t* )calloc(new_seed_cnt << 1, 4); #endif set_pos_n_single = (uint32_t* )calloc(thread_n, 4); spa_i_single = (uint32_t* )calloc(thread_n, 4); seedpa1_single = (seed_pa_single** )calloc(thread_n, sizeof(seed_pa_single* )); for(r_i = 0; r_i < thread_n; r_i++) seedpa1_single[r_i] = (seed_pa_single* )calloc(new_seed_cnt << 1, sizeof(seed_pa_single )); pos_add = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) pos_add[r_i] = (uint8_t* )calloc(pos_n_max, 1); fprintf(stderr, "Load seed reduction allocation\n"); #ifdef UNPIPATH_OFF_K20 op_vector_pos1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_vector_pos1[r_i] = (uint64_t* )calloc(cus_max_output_ali, 8); ops_vector_pos1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_vector_pos1[r_i] = (uint64_t* )calloc(cus_max_output_ali, 4); #else op_vector_pos1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_vector_pos1[r_i] = (uint32_t* )calloc(cus_max_output_ali, 4); ops_vector_pos1 = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_vector_pos1[r_i] = (uint32_t* )calloc(cus_max_output_ali, 4); #endif op_dm_l1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_l1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_r1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_r1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_l1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_l1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_r1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_r1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_vector_seq1 = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) { op_vector_seq1[r_i] = (uint64_t** )calloc(cus_max_output_ali, sizeof(uint64_t* )); for(m = 0; m < cus_max_output_ali; m++) if((op_vector_seq1[r_i][m] = (uint64_t* )calloc((((readlen_max - 1) >> 5) + 3), 8)) == NULL) exit(1); } ops_vector_seq1 = (uint64_t*** )calloc(thread_n, sizeof(uint64_t** )); for(r_i = 0; r_i < thread_n; r_i++) { ops_vector_seq1[r_i] = (uint64_t** )calloc(cus_max_output_ali, sizeof(uint64_t* )); for(m = 0; m < cus_max_output_ali; m++) if((ops_vector_seq1[r_i][m] = (uint64_t* )calloc((((readlen_max - 1) >> 5) + 3), 8)) == NULL) exit(1); } fprintf(stderr, "Load alignment allocation\n"); #ifdef ALT_ALL chr_res = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) chr_res[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); sam_pos1s = (uint32_t** )calloc(thread_n, sizeof(uint32_t* )); for(r_i = 0; r_i < thread_n; r_i++) if((sam_pos1s[r_i] = (uint32_t* )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(uint32_t ))) == NULL) exit(1); cigar_p1s = (char*** )calloc(thread_n, sizeof(char** )); for(r_i = 0; r_i < thread_n; r_i++) { cigar_p1s[r_i] = (char** )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(char* )); for(m = 0; m < CUS_MAX_OUTPUT_ALI2; m++) if((cigar_p1s[r_i][m] = (char* )calloc(cigar_max_n, 1)) == NULL) exit(1); } xa_d1s = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) xa_d1s[r_i] = (char* )calloc(CUS_MAX_OUTPUT_ALI2, 1); lv_re1s = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) lv_re1s[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, sizeof(int)); #endif fprintf(stderr, "Load output allocation\n"); op_rc = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) op_rc[r_i] = (uint8_t* )calloc(cus_max_output_ali, 1); ops_rc = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); for(r_i = 0; r_i < thread_n; r_i++) ops_rc[r_i] = (uint8_t* )calloc(cus_max_output_ali, 1); ref_seq_tmp1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ref_seq_tmp1[r_i] = (uint64_t* )calloc((((readlen_max - 1) >> 5) + 3), 8); cov_a_n_s = (uint8_t* )calloc(thread_n, 1); s_uid_f = (uint8_t* )calloc(thread_n, 1); seed_l = (int16_t* )calloc(thread_n, 2);//cannot be 0 max_mismatch = (uint8_t* )calloc(thread_n, 1); max_mismatch_p = (uint8_t* )calloc(thread_n, 1); dm_op = (int* )calloc(thread_n, 4); dm_ops = (int* )calloc(thread_n, 4); low_mask = (uint64_t* )calloc(thread_n, 8); cigar_m = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) cigar_m[r_i] = (char* )calloc(CIGARMN, 1); ali_ref_seq = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) ali_ref_seq[r_i] = (char* )calloc(readlen_max + 64, 1); read_char = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) read_char[r_i] = (char* )calloc(readlen_max + 32, 1); pos_ren[0][0] = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); pos_ren[1][1] = (uint16_t* )calloc(thread_n, sizeof(uint16_t )); sub_mask = (uint16_t** )calloc(thread_n, sizeof(uint16_t* )); for(r_i = 0; r_i < thread_n; r_i++) sub_mask[r_i] = (uint16_t* )calloc(33, 2); ex_d_mask = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); for(r_i = 0; r_i < thread_n; r_i++) ex_d_mask[r_i] = (uint64_t* )calloc(33, 8); read_bit_1 = (uint64_t** )calloc(thread_n, sizeof(uint64_t* )); read_val_1 = (uint8_t** )calloc(thread_n, sizeof(uint8_t* )); read_val1 = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { read_val1[r_i] = (uint8_t** )calloc(2, sizeof(uint8_t* )); read_val1[r_i][0] = (uint8_t* )calloc(readlen_max, 1); read_val1[r_i][1] = (uint8_t* )calloc(readlen_max, 1); } qual_arr_single = (float** )calloc(thread_n, sizeof(float* )); for(r_i = 0; r_i < thread_n; r_i++) qual_arr_single[r_i] = (float* )calloc(readlen_max, sizeof(float )); #endif #ifdef PAIR_RANDOM_SEED seed_r_dup = (uint32_t* )calloc(RANDOM_RANGE, 4); srand((unsigned)time(0)); pos_r_nr = RANDOM_RANGE; r_dup_i = 0; for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE_MAX; pos_r_ir++) if((rand() % (RANDOM_RANGE_MAX - pos_r_ir)) < pos_r_nr) { seed_r_dup[r_dup_i++] = pos_r_ir; pos_r_nr--; } random_buffer = (uint32_t* )malloc((RAN_CIR) << 2); for(pos_r_ir = 0; pos_r_ir < RAN_CIR; pos_r_ir++) random_buffer[pos_r_ir] = (uint32_t )rand(); #endif #ifdef READN_RANDOM_SEED random_buffer_readn = (uint32_t* )calloc(RANDOM_RANGE_READN, 4); for(pos_r_ir = 0; pos_r_ir < RANDOM_RANGE_READN; pos_r_ir++) random_buffer_readn[pos_r_ir] = (uint32_t )rand(); #endif InitiateLVCompute(L, thread_n); //for pthread read input fprintf(stderr, "Load seq input memory\n"); seqio = (seq_io* )calloc(read_in, sizeof(seq_io)); char** read_seq1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) read_seq1_buffer[r_i] = (char* )calloc(readlen_max, 1); char** name_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) name_buffer[r_i] = (char* )calloc(readlen_name, 1); qual1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) qual1_buffer[r_i] = (char* )calloc(readlen_max, 1); #ifdef OUTPUT_ARR read_rev_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) read_rev_buffer[r_i] = (char* )calloc(readlen_max, 1); pr_cigar1_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) pr_cigar1_buffer[r_i] = (char* )calloc(cigar_max_n, 1); chr_res_buffer = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) chr_res_buffer[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); xa_d1s_buffer = (char** )calloc(read_in, sizeof(char* )); for(r_i = 0; r_i < read_in; r_i++) xa_d1s_buffer[r_i] = (uint8_t* )calloc(CUS_MAX_OUTPUT_ALI2, 1); sam_pos1s_buffer = (uint32_t** )calloc(read_in, sizeof(uint32_t* )); for(r_i = 0; r_i < read_in; r_i++) sam_pos1s_buffer[r_i] = (uint32_t* )calloc(CUS_MAX_OUTPUT_ALI2, 4); lv_re1s_buffer = (int** )calloc(read_in, sizeof(int* )); for(r_i = 0; r_i < read_in; r_i++) lv_re1s_buffer[r_i] = (int* )calloc(CUS_MAX_OUTPUT_ALI2, 4); #endif #ifdef KSW_ALN ali_ref_seq2 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) ali_ref_seq2[r_i] = (char* )calloc(readlen_max + 64, 1); read_char2 = (char** )calloc(thread_n, sizeof(char* )); for(r_i = 0; r_i < thread_n; r_i++) read_char2[r_i] = (char* )calloc(readlen_max + 32, 1); op_dm_kl1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_kl1[r_i] = (int* )calloc(cus_max_output_ali, 4); op_dm_kr1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) op_dm_kr1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_kl1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_kl1[r_i] = (int* )calloc(cus_max_output_ali, 4); ops_dm_kr1 = (int** )calloc(thread_n, sizeof(int* )); for(r_i = 0; r_i < thread_n; r_i++) ops_dm_kr1[r_i] = (int* )calloc(cus_max_output_ali, 4); int8_t l, k1; mat = (int8_t*)calloc(25, sizeof(int8_t)); for (l = k1 = 0; l < 4; ++l) { for (m = 0; m < 4; ++m) mat[k1++] = l == m ? 1 : -4; /* weight_match : -weight_mismatch */ mat[k1++] = -1; // ambiguous base } for (m = 0; m < 5; ++m) mat[k1++] = 0; #endif #ifdef QUAL_FILT_LV_MIS_SINGLE_END qual_filt_lv1 = (uint8_t*** )calloc(thread_n, sizeof(uint8_t** )); for(r_i = 0; r_i < thread_n; r_i++) { qual_filt_lv1[r_i] = (uint8_t** )calloc(2, sizeof(uint8_t* )); qual_filt_lv1[r_i][0] = (uint8_t* )calloc(readlen_max, 1); qual_filt_lv1[r_i][1] = (uint8_t* )calloc(readlen_max, 1); } #endif #ifdef ALTER_DEBUG_SINGLE_END seed_length_arr = (seed_length_array** )calloc(thread_n, sizeof(seed_length_array* )); for(r_i = 0; r_i < thread_n; r_i++) seed_length_arr[r_i] = (seed_length_array* )calloc(cus_max_output_ali, sizeof(seed_length_array)); rep_go = (uint8_t* )calloc(thread_n, 1); #endif #ifdef MAPPING_QUALITY_SINGLE_END mp_subs1 = (float*** )calloc(thread_n, sizeof(float** )); for(r_i = 0; r_i < thread_n; r_i++) { mp_subs1[r_i] = (float** )calloc(2, sizeof(float* )); mp_subs1[r_i][0] = (float* )calloc(readlen_max, sizeof(float)); mp_subs1[r_i][1] = (float* )calloc(readlen_max, sizeof(float)); } sub_t = (float* )calloc(thread_n, sizeof(float )); #endif end = clock(); t = (double)(end - start) / CLOCKS_PER_SEC; fprintf(stderr, "%lf seconds is used for allocating memory\n", t); fprintf(stderr, "begin reading fastq single-end reads and doing seed reduction and alignment\n"); #ifdef R_W_LOCK pthread_rwlock_init(&rwlock, NULL); int seqii_i = 0; #endif double dtime = omp_get_wtime(); //value in seconds while (kr1 >= 0) { for(seqii = 0; (seqii < read_in) && ((kr1 = kseq_read(seq1)) > 0); seqii++) //(kr1 >= 0) { strncpy(name_buffer[seqii], seq1->name.s, seq1->name.l); if((seq1->name.s)[seq1->name.l - 2] == '/') name_buffer[seqii][seq1->name.l - 2] = '\0'; else name_buffer[seqii][seq1->name.l] = '\0'; if(seq1->seq.l > readlen_max) { seqio[seqii].read_length1 = readlen_max; seqio[seqii].length_h1 = seq1->seq.l - readlen_max; } else { seqio[seqii].read_length1 = seq1->seq.l; seqio[seqii].length_h1 = 0; } read_length_tmp = seqio[seqii].read_length1; strncpy(read_seq1_buffer[seqii], seq1->seq.s, read_length_tmp); read_seq1_buffer[seqii][read_length_tmp] = '\0'; strncpy(qual1_buffer[seqii], seq1->qual.s, read_length_tmp); qual1_buffer[seqii][read_length_tmp] = '\0'; seqio[seqii].read_seq1 = read_seq1_buffer[seqii]; seqio[seqii].name = name_buffer[seqii]; seqio[seqii].qual1 = qual1_buffer[seqii]; } if(thread_n <= 1) { #ifdef R_W_LOCK for(seqii_i = 0; seqii_i < seqii; seqii_i++) seed_ali_core_single_end(seqii_i, 0); #else seed_ali_core_single_end(seqii, 0); #endif } else { pthread_t* tid; thread_ali_t* data; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); data = (thread_ali_t* )calloc(thread_n, sizeof(thread_ali_t )); tid = (pthread_t* )calloc(thread_n, sizeof(pthread_t )); for(r_i = 0; r_i < thread_n; ++r_i) { data[r_i].tid = r_i; data[r_i].seqn = seqii; pthread_create(&tid[r_i], &attr, worker_single_end, data + r_i); } for(r_i = 0; r_i < thread_n; ++r_i) pthread_join(tid[r_i], 0); free(data); free(tid); } //output #ifdef OUTPUT_ARR for(seqi = 0; seqi < seqii; seqi++) { if(seqio[seqi].length_h1 == 0) { fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s\t*\t0\t0\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, seqio[seqi].seq1, seqio[seqi].qual1 ); if(seqio[seqi].xa_n > 0) { fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n; v_cnt_i++) fprintf(fp_sam, "%s,%c%u,%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d1s[v_cnt_i], seqio[seqi].sam_pos1s[v_cnt_i], seqio[seqi].cigar_p1s[v_cnt_i], seqio[seqi].lv_re1s[v_cnt_i]); } fprintf(fp_sam, "\tNM:i:%u\n",seqio[seqi].nm1); } else { sprintf(h_chars, "%uH", seqio[seqi].length_h1); fprintf(fp_sam, "%s\t%u\t%s\t%"PRId64"\t%d\t%s%s\t*\t0\t0\t%s\t%s", seqio[seqi].name, seqio[seqi].flag1, chr_names[seqio[seqi].chr_re], seqio[seqi].pos1, seqio[seqi].qualc1, seqio[seqi].cigar1, h_chars, seqio[seqi].seq1, seqio[seqi].qual1 ); if(seqio[seqi].xa_n > 0) { fprintf(fp_sam, "\tXA:Z:"); for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n; v_cnt_i++) { fprintf(fp_sam, "%s,%c%u,%s%s,%d;",chr_names[seqio[seqi].chr_res[v_cnt_i]], seqio[seqi].xa_d1s[v_cnt_i], seqio[seqi].sam_pos1s[v_cnt_i], seqio[seqi].cigar_p1s[v_cnt_i], h_chars, seqio[seqi].lv_re1s[v_cnt_i]); } } fprintf(fp_sam, "\tNM:i:%u\n",seqio[seqi].nm1); } } #endif #ifdef OUTPUT_ARR for(seqi = 0; seqi < seqii; seqi++) { if(seqio[seqi].xa_n > 0) // { for(v_cnt_i = 0; v_cnt_i < seqio[seqi].xa_n; v_cnt_i++) { free(seqio[seqi].cigar_p1s[v_cnt_i]); } } } #endif } dtime = omp_get_wtime() - dtime; fprintf(stderr, "%lf seconds is used \n", dtime); fflush(stdout); #ifdef R_W_LOCK pthread_rwlock_destroy(&rwlock); #endif #ifdef PTHREAD_USE if(g_low != NULL) free(g_low); if(r_low != NULL) free(r_low); for(r_i = 0; r_i < thread_n; r_i++) if(seedm[r_i] != NULL) free(seedm[r_i]); if(seedm != NULL) free(seedm); for(r_i = 0; r_i < thread_n; r_i++) if(seedu[r_i] != NULL) free(seedu[r_i]); if(seedu != NULL) free(seedu); for(r_i = 0; r_i < thread_n; r_i++) if(seedsets[r_i] != NULL) free(seedsets[r_i]); if(seedsets != NULL) free(seedsets); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_off[r_i] != NULL) free(seed_set_off[r_i]); if(seed_set_off != NULL) free(seed_set_off); for(r_i = 0; r_i < thread_n; r_i++) if(seed_set_pos_single[r_i] != NULL) free(seed_set_pos_single[r_i]); if(seed_set_pos_single != NULL) free(seed_set_pos_single); if(set_pos_n_single != NULL) free(set_pos_n_single); if(spa_i_single != NULL) free(spa_i_single); for(r_i = 0; r_i < thread_n; r_i++) if(seedpa1_single[r_i] != NULL) free(seedpa1_single[r_i]); if(seedpa1_single != NULL) free(seedpa1_single); #ifdef SINGLE_PAIR if(cov_num_front_single != NULL) free(cov_num_front_single); if(cov_num_re_single != NULL) free(cov_num_re_single); #endif for(r_i = 0; r_i < thread_n; r_i++) if(pos_add[r_i] != NULL) free(pos_add[r_i]); if(pos_add != NULL) free(pos_add); for(r_i = 0; r_i < thread_n; r_i++) if(op_vector_pos1[r_i] != NULL) free(op_vector_pos1[r_i]); if(op_vector_pos1 != NULL) free(op_vector_pos1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_vector_pos1[r_i] != NULL) free(ops_vector_pos1[r_i]); if(ops_vector_pos1 != NULL) free(ops_vector_pos1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_l1[r_i] != NULL) free(op_dm_l1[r_i]); if(op_dm_l1 != NULL) free(op_dm_l1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_r1[r_i] != NULL) free(op_dm_r1[r_i]); if(op_dm_r1 != NULL) free(op_dm_r1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_l1[r_i] != NULL) free(ops_dm_l1[r_i]); if(ops_dm_l1 != NULL) free(ops_dm_l1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_r1[r_i] != NULL) free(ops_dm_r1[r_i]); if(ops_dm_r1 != NULL) free(ops_dm_r1); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < cus_max_output_ali; m++) if(op_vector_seq1[r_i][m] != NULL) free(op_vector_seq1[r_i][m]); if(op_vector_seq1[r_i] != NULL) free(op_vector_seq1[r_i]); } if(op_vector_seq1 != NULL) free(op_vector_seq1); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < cus_max_output_ali; m++) if(ops_vector_seq1[r_i][m] != NULL) free(ops_vector_seq1[r_i][m]); if(ops_vector_seq1[r_i] != NULL) free(ops_vector_seq1[r_i]); } if(ops_vector_seq1 != NULL) free(ops_vector_seq1); #ifdef ALT_ALL for(r_i = 0; r_i < thread_n; r_i++) if(chr_res[r_i] != NULL) free(chr_res[r_i]); if(chr_res != NULL) free(chr_res); for(r_i = 0; r_i < thread_n; r_i++) if(sam_pos1s[r_i] != NULL) free(sam_pos1s[r_i]); if(sam_pos1s != NULL) free(sam_pos1s); for(r_i = 0; r_i < thread_n; r_i++) { for(m = 0; m < CUS_MAX_OUTPUT_ALI2; m++) if(cigar_p1s[r_i][m] != NULL) free(cigar_p1s[r_i][m]); if(cigar_p1s[r_i] != NULL) free(cigar_p1s[r_i]); } if(cigar_p1s != NULL) free(cigar_p1s); for(r_i = 0; r_i < thread_n; r_i++) if(xa_d1s[r_i] != NULL) free(xa_d1s[r_i]); if(xa_d1s != NULL) free(xa_d1s); for(r_i = 0; r_i < thread_n; r_i++) if(lv_re1s[r_i] != NULL) free(lv_re1s[r_i]); if(lv_re1s != NULL) free(lv_re1s); #endif for(r_i = 0; r_i < thread_n; r_i++) if(op_rc[r_i] != NULL) free(op_rc[r_i]); if(op_rc != NULL) free(op_rc); for(r_i = 0; r_i < thread_n; r_i++) if(ops_rc[r_i] != NULL) free(ops_rc[r_i]); if(ops_rc != NULL) free(ops_rc); for(r_i = 0; r_i < thread_n; r_i++) if(ref_seq_tmp1[r_i] != NULL) free(ref_seq_tmp1[r_i]); if(ref_seq_tmp1 != NULL) free(ref_seq_tmp1); if(cov_a_n_s != NULL) free(cov_a_n_s); if(s_uid_f != NULL) free(s_uid_f); if(max_mismatch != NULL) free(max_mismatch); if(max_mismatch_p != NULL) free(max_mismatch_p); if(dm_op != NULL) free(dm_op); if(dm_ops != NULL) free(dm_ops); if(low_mask != NULL) free(low_mask); for(r_i = 0; r_i < thread_n; r_i++) if(cigar_m[r_i] != NULL) free(cigar_m[r_i]); if(cigar_m != NULL) free(cigar_m); for(r_i = 0; r_i < thread_n; r_i++) if(ali_ref_seq[r_i] != NULL) free(ali_ref_seq[r_i]); if(ali_ref_seq != NULL) free(ali_ref_seq); for(r_i = 0; r_i < thread_n; r_i++) if(read_char[r_i] != NULL) free(read_char[r_i]); if(read_char != NULL) free(read_char); if(pos_ren[0][0] != NULL) free(pos_ren[0][0]); if(pos_ren[1][1] != NULL) free(pos_ren[1][1]); for(r_i = 0; r_i < thread_n; r_i++) if(sub_mask[r_i] != NULL) free(sub_mask[r_i]); if(sub_mask != NULL) free(sub_mask); for(r_i = 0; r_i < thread_n; r_i++) if(ex_d_mask[r_i] != NULL) free(ex_d_mask[r_i]); if(ex_d_mask != NULL) free(ex_d_mask); if(read_bit_1 != NULL) free(read_bit_1); if(read_val_1 != NULL) free(read_val_1); for(r_i = 0; r_i < thread_n; r_i++) { if(read_val1[r_i][0] != NULL) free(read_val1[r_i][0]); if(read_val1[r_i][1] != NULL) free(read_val1[r_i][1]); if(read_val1[r_i] != NULL) free(read_val1[r_i]); } if(read_val1 != NULL) free(read_val1); for(r_i = 0; r_i < thread_n; r_i++) if(qual_arr_single[r_i] != NULL) free(qual_arr_single[r_i]); if(qual_arr_single != NULL) free(qual_arr_single); #endif #ifdef PAIR_RANDOM_SEED if(seed_r_dup != NULL) free(seed_r_dup); if(random_buffer != NULL) free(random_buffer); #endif #ifdef READN_RANDOM_SEED if(random_buffer_readn) free(random_buffer_readn); #endif if(seqio != NULL) free(seqio); for(r_i = 0; r_i < thread_n; r_i++) if(read_seq1_buffer[r_i] != NULL) free(read_seq1_buffer[r_i]); if(read_seq1_buffer != NULL) free(read_seq1_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(name_buffer[r_i] != NULL) free(name_buffer[r_i]); if(name_buffer != NULL) free(name_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(qual1_buffer[r_i] != NULL) free(qual1_buffer[r_i]); if(qual1_buffer != NULL) free(qual1_buffer); #ifdef OUTPUT_ARR for(r_i = 0; r_i < thread_n; r_i++) if(read_rev_buffer[r_i] != NULL) free(read_rev_buffer[r_i]); if(read_rev_buffer != NULL) free(read_rev_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(pr_cigar1_buffer[r_i] != NULL) free(pr_cigar1_buffer[r_i]); if(pr_cigar1_buffer != NULL) free(pr_cigar1_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(chr_res_buffer[r_i] != NULL) free(chr_res_buffer[r_i]); if(chr_res_buffer != NULL) free(chr_res_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(xa_d1s_buffer[r_i] != NULL) free(xa_d1s_buffer[r_i]); if(xa_d1s_buffer != NULL) free(xa_d1s_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(sam_pos1s_buffer[r_i] != NULL) free(sam_pos1s_buffer[r_i]); if(sam_pos1s_buffer != NULL) free(sam_pos1s_buffer); for(r_i = 0; r_i < thread_n; r_i++) if(lv_re1s_buffer[r_i] != NULL) free(lv_re1s_buffer[r_i]); if(lv_re1s_buffer != NULL) free(lv_re1s_buffer); #endif #ifdef KSW_ALN for(r_i = 0; r_i < thread_n; r_i++) if(ali_ref_seq2[r_i] != NULL) free(ali_ref_seq2[r_i]); if(ali_ref_seq2 != NULL) free(ali_ref_seq2); for(r_i = 0; r_i < thread_n; r_i++) if(read_char2[r_i] != NULL) free(read_char2[r_i]); if(read_char2 != NULL) free(read_char2); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_kl1[r_i] != NULL) free(op_dm_kl1[r_i]); if(op_dm_kl1 != NULL) free(op_dm_kl1); for(r_i = 0; r_i < thread_n; r_i++) if(op_dm_kr1[r_i] != NULL) free(op_dm_kr1[r_i]); if(op_dm_kr1 != NULL) free(op_dm_kr1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_kl1[r_i] != NULL) free(ops_dm_kl1[r_i]); if(ops_dm_kl1 != NULL) free(ops_dm_kl1); for(r_i = 0; r_i < thread_n; r_i++) if(ops_dm_kr1[r_i] != NULL) free(ops_dm_kr1[r_i]); if(ops_dm_kr1 != NULL) free(ops_dm_kr1); free(mat); #endif #ifdef QUAL_FILT_LV_MIS_SINGLE_END for(r_i = 0; r_i < thread_n; r_i++) { if(qual_filt_lv1[r_i][0] != NULL) free(qual_filt_lv1[r_i][0]); if(qual_filt_lv1[r_i][1] != NULL) free(qual_filt_lv1[r_i][1]); if(qual_filt_lv1[r_i] != NULL) free(qual_filt_lv1[r_i]); } if(qual_filt_lv1 != NULL) free(qual_filt_lv1); #endif #ifdef ALTER_DEBUG_SINGLE_END for(r_i = 0; r_i < thread_n; r_i++) if(seed_length_arr[r_i] != NULL) free(seed_length_arr[r_i]); if(seed_length_arr != NULL) free(seed_length_arr); if(rep_go != NULL) free(rep_go); #endif #ifdef MAPPING_QUALITY_SINGLE_END for(r_i = 0; r_i < thread_n; r_i++) { if(mp_subs1[r_i][0] != NULL) free(mp_subs1[r_i][0]); if(mp_subs1[r_i][1] != NULL) free(mp_subs1[r_i][1]); if(mp_subs1[r_i] != NULL) free(mp_subs1[r_i]); } if(sub_t != NULL) free(sub_t); #endif fclose(fp_sam); kseq_destroy(seq1); gzclose(fp1); return 0; } #ifdef R_W_LOCK int seed_ali_core_single_end(int read_seq_core, uint8_t tid) #else int seed_ali_core_single_end(uint32_t seqn, uint8_t tid) #endif { uint16_t dm_i = 0; uint8_t extension_stop = 0; char cigar_p1[MAX_LV_CIGAR]; uint8_t rc_i = 0; uint8_t lv_ref_length_re = 0; uint8_t q_n1 = 0; uint8_t c_m_f = 0; uint8_t end1_uc_f = 0; uint8_t nuc1_f = 0; uint8_t b_t_n_r = 0; uint8_t re_d = 0; uint16_t f_cigar[MAX_LV_CIGAR]; char sam_seq1[MAX_READLEN + 1] = {}; char cigarBuf1[MAX_LV_CIGAR] = {}; char cigarBuf2[MAX_LV_CIGAR] = {}; char str_o[MAX_LV_CIGAR]; char b_cigar[MAX_LV_CIGAR]; char* pch = NULL; char* saveptr = NULL; uint16_t ref_copy_num = 0; uint16_t f_cigarn = 0; uint16_t read_bit_char = 0; uint16_t rst_i = 0; uint16_t s_m_t = 0; uint16_t read_b_i = 0; uint16_t f_c = 0; uint16_t pchl = 0; uint16_t f_i = 0; uint16_t s_o = 0; uint16_t snt = 0; uint16_t d_n1 = 0; uint16_t i_n1 = 0; uint16_t read_length = 0; uint16_t lv_k = 0; uint32_t read_length_a = 0; uint32_t seqi = 0; uint32_t v_cnt = 0; uint32_t vs_cnt = 0; uint32_t ref_copy_num_chars = 0; uint32_t r_i = 0; uint32_t psp_i = 0; uint32_t d_l1 = 0; uint32_t d_r1 = 0; uint32_t mis_c_n = 0; uint32_t xa_i = 0; uint32_t v_cnt_i = 0; uint32_t va_cnt_i = 0; uint32_t sam_flag1 = 0; uint32_t seed1_i = 0; uint32_t sam_seq_i = 0; uint32_t max_single_score = 0; uint32_t seed_posn_filter_single = 0; int s_r_o_l1 = 0; int s_r_o_r1 = 0; int lv_re1f = 0; int sam_qual1 = 0; int chr_re = 0; int mid = 0; int low = 0; int high = 0; int m_m_n = 0; int sn = 0; int bit_char_i = 0; int dm1 = 0; int dm_l1 = 0; int dm_r1 = 0; int dmt1 = 0; int lv_dmt1 = 0; int ld1 = 0; int rd1 = 0; int cmp_re = 0; int q_rear_i = 0; int q_rear1 = 0; int cache_dml1[MAX_Q_NUM]; int cache_dmr1[MAX_Q_NUM]; int cache_dis1[MAX_Q_NUM]; int cache_kl1[MAX_Q_NUM]; int cache_kr1[MAX_Q_NUM]; uint16_t off_i = 0; uint16_t max_sets_n = 0; uint16_t max_seed_length[2]; uint64_t c_tmp = 0; uint64_t xor_tmp = 0; uint64_t ref_tmp_ori = 0; uint64_t ref_tmp_ori2 = 0; uint64_t tran_tmp_p = 0; uint64_t tran_tmp = 0; int64_t sam_pos1 = 0; uint64_t cache_end1[MAX_Q_NUM][MAX_REF_SEQ_C]; seed_pa_single* seed_pr1 = NULL; uint16_t s_offset1 = 0; int16_t s_r_o_l = 0; int16_t s_r_o_r = 0; #ifdef KSW_ALN int band_with = 33;//100 int zdrop = 0;//100 int end_bonus = 5; int tle; int gtle; int gscore; int max_off; int x_score, y_score, op_score, len_score, op_score1, len_score1, op_score2, len_score2; int k_start1 = 0; int k_start2 = 0; int k_middle = 0; uint32_t* cigar1 = NULL; uint32_t* cigar2 = NULL; int n_cigar1 = 0; int n_cigar2 = 0; int nm_score = 0; #endif #ifdef QUAL_FILT_SINGLE_END uint64_t* qual_filt_1 = NULL; uint8_t qual_filt_fix_single_end = 55;// #endif #ifdef QUAL_FILT_LV_MIS_SINGLE_END uint8_t* qual_filt_lv_1 = NULL; uint8_t* qual_filt_lv_1_o = NULL; #endif #ifdef ALTER_DEBUG_SINGLE_END uint16_t seed_length1 = 0; #endif #ifdef MAPPING_QUALITY_SINGLE_END float log_tmp = 0; float* mp_subs_1 = NULL; float* mp_subs_1_o = NULL; float m_sub_tmp = 0; #endif uint8_t mp_flag = 0; uint8_t cir_n = 0; uint16_t mis_c_n_filt = 0; int16_t dm_cir_min = 0; #ifdef UNPIPATH_OFF_K20 uint64_t posi = 0; uint64_t pos_l = 0; uint64_t x = 0; #else uint32_t posi = 0; uint32_t pos_l = 0; uint32_t x = 0; #endif #ifdef READN_RANDOM_SEED char tmp_char; uint16_t readn_re1 = 0; uint16_t readn_re2 = 0; #endif #ifdef CIGAR_LEN_ERR int cigar_len = 0; int cigar_len_tmp = 0; int cigar_len_re = 0; uint16_t pchl_tmp = 0; uint16_t s_o_tmp = 0; char* pch_tmp = NULL; char* saveptr_tmp = NULL; char cigar_tmp[MAX_LV_CIGARCOM]; #endif #ifndef R_W_LOCK for(seqi = 0; seqi < seqn; seqi++) #else if(1) #endif { #ifndef R_W_LOCK #ifdef PTHREAD_USE if ((seqi % thread_n) != tid) continue; #endif #else seqi = read_seq_core; #endif read_length = seqio[seqi].read_length1; lv_k = (read_length * max_single_score_r) + 1; read_length_a = read_length - 1; #ifdef SINGLE_PAIR cov_num_front_single[tid] = (read_length_a >> 7); cov_num_re_single[tid] = 63 - ((read_length_a >> 1) & 0X3f); #endif f_cigarn = read_length; f_cigar[f_cigarn] = '\0'; //sprintf(cigar_m[tid],"%uM\0",read_length); sprintf(cigar_m[tid],"%uM",read_length); //for bit operation read_bit_char = (((uint16_t )((read_length_a >> 5) + 1)) << 3); ref_copy_num = ((read_length_a) >> 5) + 3; ref_copy_num_chars = (ref_copy_num << 3); lv_ref_length_re = (read_length & 0X1f); for(r_i = 0; r_i <= 32 - lv_ref_length_re; r_i++) { ex_d_mask[tid][r_i] = bit_assi[lv_ref_length_re + r_i]; sub_mask[tid][r_i] = ref_copy_num - 2; } for(r_i = 33 - lv_ref_length_re; r_i <= 32; r_i++) { ex_d_mask[tid][r_i] = bit_assi[lv_ref_length_re + r_i - 32]; sub_mask[tid][r_i] = ref_copy_num - 1; } low_mask[tid] = bit_assi[lv_ref_length_re]; #ifdef QUAL_FILT_SINGLE_END memset(qual_filt1[tid][0], 0, read_bit_char); memset(qual_filt1[tid][1], 0, read_bit_char); c_tmp = 3; for(r_i = 0; r_i < read_length; r_i++) { if(seqio[seqi].qual1[r_i] < qual_filt_fix_single_end) //'7': 55 63 { qual_filt1[tid][0][r_i >> 5] |= (((uint64_t )c_tmp) << ((31 - (r_i & 0X1f)) << 1)); qual_filt1[tid][1][(read_length_a - r_i) >> 5] |= (((uint64_t )c_tmp) << ((31 - ((read_length_a - r_i) & 0X1f)) << 1)); } } for(r_i = 0; r_i < (read_length >> 5) + 1; r_i++) qual_filt1[tid][0][r_i] = ~qual_filt1[tid][0][r_i]; for(r_i = 0; r_i < (read_length >> 5) + 1; r_i++) qual_filt1[tid][1][r_i] = ~qual_filt1[tid][1][r_i]; #endif #ifdef QUAL_FILT_LV_MIS_SINGLE_END for(r_i = 0; r_i < read_length; r_i++) { if(seqio[seqi].qual1[r_i] < qual_filt_fix_single_end) qual_filt_lv1[tid][0][r_i] = 0; else qual_filt_lv1[tid][0][r_i] = 3; } for(r_i = 0; r_i < read_length; r_i++) { if(seqio[seqi].qual1[r_i] < qual_filt_fix_single_end) qual_filt_lv1[tid][1][read_length_a - r_i] = 0; else qual_filt_lv1[tid][1][read_length_a - r_i] = 3; } #endif #ifdef MAPPING_QUALITY_SINGLE_END for(r_i = 0; r_i < read_length; r_i++) { m_sub_tmp = mp_sub_bp[seqio[seqi].qual1[r_i]]; mp_subs1[tid][0][r_i] = m_sub_tmp; mp_subs1[tid][1][read_length_a - r_i] = m_sub_tmp; } #endif max_single_score = (uint32_t )(((float )read_length) * max_single_score_r); cov_a_n_s[tid] = ((read_length_a) >> 6) + 1; max_mismatch[tid] = (uint8_t )(((float )read_length) * mis_match_r); max_mismatch_p[tid] = max_mismatch[tid] - 1; memset(read_bit1[tid][0], 0, read_bit_char); memset(read_bit1[tid][1], 0, read_bit_char); r_i = 0; while ((seqio[seqi].read_seq1)[r_i]) { #ifdef READN_RANDOM_SEED tmp_char = (seqio[seqi].read_seq1)[r_i]; if(tmp_char == 'N') { readn_re1 = readn_cnt & 0X3ff; readn_re2 = readn_cnt & 0Xf; c_tmp = ((random_buffer_readn[readn_re1] >> (readn_re2 << 1)) & 0X3); readn_cnt++; } else c_tmp = charToDna5n[tmp_char]; #else c_tmp = charToDna5n[(seqio[seqi].read_seq1)[r_i]]; #endif #ifdef ALI_LV read_val1[tid][0][r_i] = c_tmp; read_val1[tid][1][read_length_a - r_i] = c_tmp ^ 0X3; #endif read_bit1[tid][0][r_i >> 5] |= (((uint64_t )c_tmp) << ((31 - (r_i & 0X1f)) << 1)); read_bit1[tid][1][(read_length_a - r_i) >> 5] |= (((uint64_t )(c_tmp ^ 0X3)) << ((31 - ((read_length_a - r_i) & 0X1f)) << 1)); r_i++; } seed_l[tid] = seed_l_max; #ifdef ALTER_DEBUG_SINGLE_END rep_go[tid] = 1; #endif cir_n = 1; while(cir_n <= cir_fix_n) { cir_cnt++; dm_op[tid] = MAX_OP_SCORE; dm_ops[tid] = MAX_OP_SCORE; v_cnt = 0; vs_cnt = 0; dm_cir_min = 0Xfff; spa_i_single[tid] = 0; set_pos_n_single[tid] = 0; for(rc_i = 0; rc_i < 2; rc_i++) { max_seed_length[rc_i] = 0; #ifdef UNPIPATH_OFF_K20 single_seed_reduction_core_single64(seedpa1_single[tid], read_bit1[tid][rc_i], read_val1[tid][rc_i], &(seed_set_pos_single[tid]), tid, read_length, &(max_seed_length[rc_i]), rc_i); #else single_seed_reduction_core_single(seedpa1_single[tid], read_bit1[tid][rc_i], read_val1[tid][rc_i], &(seed_set_pos_single[tid]), tid, read_length, &(max_seed_length[rc_i]), rc_i); #endif } if(spa_i_single[tid] == 0) { seed_l[tid] -= seed_step; } else { seed_posn_filter_single = 0; extension_stop = 0; seed_pr1 = seedpa1_single[tid]; qsort(seed_pr1, spa_i_single[tid], sizeof(seed_pa_single), compare_plen_single); max_sets_n = (max_seed_length[0] > max_seed_length[1]) ? max_seed_length[0]:max_seed_length[1]; for(off_i = 0; off_i < spa_i_single[tid]; off_i++) if(seed_pr1[off_i].length < max_sets_n >> 1) { ++off_i; break; } for(seed1_i = 0; (seed1_i < off_i) && (extension_stop == 0); seed1_i++) // { rc_i = seed_pr1[seed1_i].rc; read_bit_1[tid] = read_bit1[tid][rc_i]; #ifdef QUAL_FILT_SINGLE_END qual_filt_1 = qual_filt1[tid][rc_i]; #endif #ifdef QUAL_FILT_LV_MIS_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][rc_i]; qual_filt_lv_1_o = qual_filt_lv1[tid][1 - rc_i]; #endif if(seed_pr1[seed1_i].ui == 1) { end1_uc_f = 0; nuc1_f = 0; d_l1 = seed_pr1[seed1_i].ref_pos_off; d_r1 = seed_pr1[seed1_i].ref_pos_off_r; } else { end1_uc_f = 1; } q_rear1 = 0; q_n1 = 0; dmt1 = ali_exl; lv_dmt1 = lv_k; s_r_o_l1 = seed_pr1[seed1_i].s_r_o_l; s_r_o_r1 = seed_pr1[seed1_i].s_r_o_r; #ifdef ALTER_DEBUG_SINGLE_END seed_length1 = seed_pr1[seed1_i].length; #endif for(psp_i = 0; psp_i < seed_pr1[seed1_i].pos_n; psp_i++) { if(seed_posn_filter_single > seed_filter_pos_num_singlen) extension_stop = 1;//break; seed_posn_filter_single++; posi = seed_set_pos_single[tid][seed_pr1[seed1_i].pos_start + psp_i]; extension_cnt++; //for end1 if((end1_uc_f == 0) && ((dmt1 <= d_l1) && (dmt1 <= d_r1))) // && (nuc1_f == 0) { if(nuc1_f == 0) { pos_l = posi - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars); for(rst_i = 0; rst_i < ref_copy_num - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask[tid]; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num - 1] &= low_mask[tid]; } //exact match mis_c_n = 0; #ifdef QUAL_FILT_SINGLE_END mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num - 2]; ref_seq_tmp1[tid][ref_copy_num - 2] &= low_mask[tid]; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT_SINGLE_END mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch[tid]) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch[tid]) break; #endif } ref_seq_tmp1[tid][ref_copy_num - 2] = ref_tmp_ori; //lv if(mis_c_n_filt > max_mismatch[tid]) { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(s_r_o_l1 + 1, read_char[tid], 33 + s_r_o_l1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_l1, &tle, &gtle, &gscore, &max_off); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(read_length - s_r_o_r1, read_char[tid], 32 + read_length - s_r_o_r1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_r1, &tle, &gtle, &gscore, &max_off); dm1 = MAX_OP_SCORE - (dm_l1 + dm_r1); ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { #ifdef SPLIT_LV_SINGLE #ifdef QUAL_FILT_LV_MIS_SINGLE_END for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance_mis(ali_ref_seq[tid], 33 + s_r_o_l1, read_char[tid], s_r_o_l1 + 1, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length_a - s_r_o_l1); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r1, read_char[tid], read_length - s_r_o_r1, lv_dmt1, L[tid], qual_filt_lv_1 + s_r_o_r1); dm1 = dm_l1 + dm_r1; #else //split lv for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + s_r_o_l1, read_char[tid], s_r_o_l1 + 1, lv_dmt1, L[tid]); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + read_length - s_r_o_r1, read_char[tid], read_length - s_r_o_r1, lv_dmt1, L[tid]); dm1 = dm_l1 + dm_r1; #endif ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } } else { dm1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) //need to be modified { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch_p[tid]) { dmt1 = 0; } } else { dm1 = MAX_EDIT_SCORE; } nuc1_f = 1; } } else { pos_l = posi - max_extension_length - 1; re_d = pos_l & 0X1f; b_t_n_r = 32 - re_d; if(re_d != 0) { tran_tmp_p = (buffer_ref_seq[pos_l >> 5] & bit_tran_re[re_d]); memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5) + 1, ref_copy_num_chars); for(rst_i = 0; rst_i < ref_copy_num - 1; rst_i++) { tran_tmp = (ref_seq_tmp1[tid][rst_i] & bit_tran_re[re_d]); ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); tran_tmp_p = tran_tmp; } ref_seq_tmp1[tid][rst_i] >>= (b_t_n_r << 1); ref_seq_tmp1[tid][rst_i] |= (tran_tmp_p << (re_d << 1)); //clear the lowest n bit ref_seq_tmp1[tid][rst_i] &= low_mask[tid]; } else { memcpy(ref_seq_tmp1[tid], buffer_ref_seq + (pos_l >> 5), ref_copy_num_chars); //clear the lowest n bit ref_seq_tmp1[tid][ref_copy_num - 1] &= low_mask[tid]; } //trim the beginning and end of the current ref seq based on current minimum edit distance dm_t s_m_t = sub_mask[tid][dmt1]; ref_seq_tmp1[tid][0] &= bit_tran[dmt1]; ref_seq_tmp1[tid][s_m_t] &= ex_d_mask[tid][dmt1]; //traverse and check whether there is an existing seq that is as same as current new ref seq c_m_f = 0; for(q_rear_i = q_rear1 - 1; q_rear_i >= 0; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask[tid][dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; #ifdef KSW_ALN dm_l1 = cache_kl1[q_rear_i]; dm_r1 = cache_kr1[q_rear_i]; #endif c_m_f = 1; break; } } if((q_n1 > MAX_Q_NUM) && (q_rear_i < 0)) { for(q_rear_i = MAX_Q_NUM - 1; q_rear_i >= q_rear1; q_rear_i--) { ref_tmp_ori = cache_end1[q_rear_i][0]; cache_end1[q_rear_i][0] &= bit_tran[dmt1]; ref_tmp_ori2 = cache_end1[q_rear_i][s_m_t]; cache_end1[q_rear_i][s_m_t] &= ex_d_mask[tid][dmt1]; cmp_re = memcmp(cache_end1[q_rear_i], ref_seq_tmp1[tid], (s_m_t + 1) << 3); cache_end1[q_rear_i][0] = ref_tmp_ori; cache_end1[q_rear_i][s_m_t] = ref_tmp_ori2; if(cmp_re == 0) { //deal with finding an alignment dm1 = cache_dis1[q_rear_i]; ld1 = cache_dml1[q_rear_i]; rd1 = cache_dmr1[q_rear_i]; #ifdef KSW_ALN dm_l1 = cache_kl1[q_rear_i]; dm_r1 = cache_kr1[q_rear_i]; #endif c_m_f = 1; break; } } } //do not find the seq in cache, exact match or lv and add into cache if(c_m_f == 0) { //exact match mis_c_n = 0; #ifdef QUAL_FILT_SINGLE_END mis_c_n_filt = 0; #endif ref_tmp_ori = ref_seq_tmp1[tid][ref_copy_num - 2]; ref_seq_tmp1[tid][ref_copy_num - 2] &= low_mask[tid]; for(rst_i = 1, read_b_i = 0; rst_i < ref_copy_num - 1; rst_i++, read_b_i++) { xor_tmp = ref_seq_tmp1[tid][rst_i] ^ read_bit_1[tid][read_b_i]; #ifdef QUAL_FILT_SINGLE_END mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); xor_tmp &= qual_filt_1[read_b_i]; mis_c_n_filt += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); if(mis_c_n_filt > max_mismatch[tid]) break; #else mis_c_n += popcount_3((((xor_tmp & low_bit_mask) << 1) | (xor_tmp & high_bit_mask))); mis_c_n_filt = mis_c_n; if(mis_c_n > max_mismatch[tid]) break; #endif } ref_seq_tmp1[tid][ref_copy_num - 2] = ref_tmp_ori; //lv if(mis_c_n_filt > max_mismatch[tid]) { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(s_r_o_l1 + 1, read_char[tid], 33 + s_r_o_l1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_l1, &tle, &gtle, &gscore, &max_off); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_extend(read_length - s_r_o_r1, read_char[tid], 32 + read_length - s_r_o_r1, ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, end_bonus, zdrop, s_r_o_r1 - s_r_o_l1, &dm_r1, &tle, &gtle, &gscore, &max_off); dm1 = MAX_OP_SCORE - (dm_l1 + dm_r1); ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } else { #ifdef SPLIT_LV_SINGLE #ifdef QUAL_FILT_LV_MIS_SINGLE_END for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance_mis(ali_ref_seq[tid], 33 + s_r_o_l1, read_char[tid], s_r_o_l1 + 1, lv_dmt1, L[tid], qual_filt_lv_1_o + read_length_a - s_r_o_l1); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r1, read_char[tid], read_length - s_r_o_r1, lv_dmt1, L[tid], qual_filt_lv_1 + s_r_o_r1); dm1 = dm_l1 + dm_r1; #else //split lv for(bit_char_i = s_r_o_l1, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l1, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_l1 = computeEditDistance(ali_ref_seq[tid], 33 + s_r_o_l1, read_char[tid], s_r_o_l1 + 1, lv_dmt1, L[tid]); for(bit_char_i = s_r_o_r1, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r1, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ref_seq_tmp1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); dm_r1 = computeEditDistance(ali_ref_seq[tid], 32 + read_length - s_r_o_r1, read_char[tid], read_length - s_r_o_r1, lv_dmt1, L[tid]); dm1 = dm_l1 + dm_r1; #endif ld1 = s_r_o_l1; rd1 = s_r_o_r1; #endif } } else { dm1 = mis_c_n; ld1 = 0; rd1 = 0; dm_l1 = 0; dm_r1 = 0; } //these two values could be different if((dm_l1 != -1) && (dm_r1 != -1)) { if(dm1 < dmt1) dmt1 = dm1 + 1; if(dm1 < lv_dmt1) lv_dmt1 = dm1 + 1; if(dm1 < max_mismatch_p[tid]) { dmt1 = 0; } } else { dm1 = MAX_EDIT_SCORE; } //add the ref sequence at the end of queue memcpy(cache_end1[q_rear1], ref_seq_tmp1[tid], ref_copy_num_chars); cache_dis1[q_rear1] = dm1; cache_dml1[q_rear1] = ld1; cache_dmr1[q_rear1] = rd1; #ifdef KSW_ALN cache_kl1[q_rear1] = dm_l1; cache_kr1[q_rear1] = dm_r1; #endif q_rear1 = ((q_rear1 + 1) & 0X1f); ++q_n1; //add edit distance } } if(dm1 < dm_cir_min) dm_cir_min = dm1; if(dm1 < dm_op[tid]) { #ifdef DM_COPY_SINGLE for(dm_i = 0; dm_i < v_cnt; dm_i++) { ops_vector_pos1[tid][dm_i] = op_vector_pos1[tid][dm_i]; ops_dm_l1[tid][dm_i] = op_dm_l1[tid][dm_i]; ops_dm_r1[tid][dm_i] = op_dm_r1[tid][dm_i]; ops_dm_kl1[tid][dm_i] = op_dm_kl1[tid][dm_i]; ops_dm_kr1[tid][dm_i] = op_dm_kr1[tid][dm_i]; ops_rc[tid][dm_i] = op_rc[tid][dm_i]; #ifdef MAPPING_QUALITY_SINGLE_END memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars); #else if(!((op_dm_l1[tid][dm_i] == 0) && (op_dm_r1[tid][dm_i] == 0))) memcpy(ops_vector_seq1[tid][dm_i], op_vector_seq1[tid][dm_i], ref_copy_num_chars); #endif } vs_cnt = v_cnt; dm_ops[tid] = dm_op[tid]; #endif v_cnt = 0; op_vector_pos1[tid][v_cnt] = posi; #ifdef MAPPING_QUALITY_SINGLE_END memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #endif op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; #ifdef KSW_ALN op_dm_kl1[tid][v_cnt] = dm_l1; op_dm_kr1[tid][v_cnt] = dm_r1; #endif #ifdef ALTER_DEBUG_SINGLE_END seed_length_arr[tid][v_cnt].seed_length = seed_length1; seed_length_arr[tid][v_cnt].index = v_cnt; #endif op_rc[tid][v_cnt] = ((rc_i << 1) + rc_i); ++v_cnt; dm_op[tid] = dm1; } else if(dm1 == dm_op[tid]) { if(v_cnt < cus_max_output_ali) { op_vector_pos1[tid][v_cnt] = posi; #ifdef MAPPING_QUALITY_SINGLE_END memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(op_vector_seq1[tid][v_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #endif op_dm_l1[tid][v_cnt] = ld1; op_dm_r1[tid][v_cnt] = rd1; #ifdef KSW_ALN op_dm_kl1[tid][v_cnt] = dm_l1; op_dm_kr1[tid][v_cnt] = dm_r1; #endif #ifdef ALTER_DEBUG_SINGLE_END seed_length_arr[tid][v_cnt].seed_length = seed_length1; seed_length_arr[tid][v_cnt].index = v_cnt; #endif op_rc[tid][v_cnt] = ((rc_i << 1) + rc_i); ++v_cnt; } } else if(dm1 < dm_ops[tid]) { vs_cnt = 0; ops_vector_pos1[tid][vs_cnt] = posi; #ifdef MAPPING_QUALITY_SINGLE_END memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #endif ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; #ifdef KSW_ALN ops_dm_kl1[tid][vs_cnt] = dm_l1; ops_dm_kr1[tid][vs_cnt] = dm_r1; #endif ops_rc[tid][vs_cnt] = ((rc_i << 1) + rc_i); ++vs_cnt; dm_ops[tid] = dm1; } else if(dm1 == dm_ops[tid]) { if(vs_cnt < cus_max_output_ali) { ops_vector_pos1[tid][vs_cnt] = posi; #ifdef MAPPING_QUALITY_SINGLE_END memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #else if(!((ld1 == 0) && (rd1 == 0))) memcpy(ops_vector_seq1[tid][vs_cnt], ref_seq_tmp1[tid], ref_copy_num_chars); #endif ops_dm_l1[tid][vs_cnt] = ld1; ops_dm_r1[tid][vs_cnt] = rd1; #ifdef KSW_ALN ops_dm_kl1[tid][vs_cnt] = dm_l1; ops_dm_kr1[tid][vs_cnt] = dm_r1; #endif ops_rc[tid][vs_cnt] = ((rc_i << 1) + rc_i); ++vs_cnt; } } } } #ifdef CIR_CONTINUE_SINGLE_END if(local_ksw) { if((dm_cir_min > max_single_score) && (cir_n != cir_fix_n)) { seed_l[tid] -= seed_step; cir_n = cir_fix_n; continue; } } else { if(dm_cir_min > max_single_score) { seed_l[tid] -= seed_step; cir_n++; if(last_circle_rate) { lv_k = (read_length * last_circle_rate); max_single_score = lv_k; } continue; } } #else if((dm_op[tid] > max_single_score) && (cir_n < cir_fix_n)) { seed_l[tid] -= seed_step; cir_n++; continue; } #endif break; } cir_n++; } //output if(v_cnt > 0) { #ifdef ALTER_DEBUG_SINGLE_END if(v_cnt > 1) qsort(seed_length_arr[tid], v_cnt, sizeof(seed_length_array), compare_seed_length); #endif #ifdef MAPPING_QUALITY_SINGLE_END if(v_cnt > 1) { sam_qual1 = 0; mp_flag = 0; } else if(vs_cnt == 0) { sam_qual1 = 60; mp_flag = 0; } else { mp_flag = 1; } #endif v_cnt_i = 0; #ifdef ALTER_DEBUG_SINGLE_END if(v_cnt > 1) v_cnt_i = seed_length_arr[tid][v_cnt_i].index; #endif x = op_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos1 = op_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; if(op_rc[tid][v_cnt_i] == 0) { #ifdef CHAR_CP_SINGLE_END read_bit_1[tid] = read_bit1[tid][0]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); #endif sam_flag1 = 0; #ifdef QUAL_FILT_LV_OUT_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) { mp_subs_1 = mp_subs1[tid][0]; mp_subs_1_o = mp_subs1[tid][1]; } #endif } else { #ifdef CHAR_CP_SINGLE_END read_bit_1[tid] = read_bit1[tid][1]; #else for(sam_seq_i = 0; sam_seq_i < read_length; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #endif sam_flag1 = 16; #ifdef QUAL_FILT_LV_OUT_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) { mp_subs_1 = mp_subs1[tid][1]; mp_subs_1_o = mp_subs1[tid][0]; } #endif } #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) sub_t[tid] = 0; #endif d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_r_o_l = op_dm_l1[tid][v_cnt_i]; s_r_o_r = op_dm_r1[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m[tid]); #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) { for (bit_char_i = 0, read_b_i = 32; bit_char_i < read_length; bit_char_i++, read_b_i++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((op_vector_seq1[tid][v_cnt_i][read_b_i >> 5] >> ((31 - (read_b_i & 0X1f)) << 1)) & 0X3)) { sub_t[tid] += mp_subs_1[bit_char_i]; } } #endif } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kl1[tid][v_cnt_i], read_char[tid], op_dm_kl1[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr1[tid][v_cnt_i], read_char2[tid], op_dm_kr1[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if(n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if(n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if(s_r_o_l >= op_dm_kl1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", s_r_o_l + 1 - op_dm_kl1[tid][v_cnt_i]); snt += sn; } if((s_r_o_l != -1) && (s_r_o_r != read_length)) { if((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if(op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if(op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) sub_t[tid] += mp_subs_1_o[read_length + n_cigar1 - s_r_o_l - x_score - read_b_i - 2]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if(s_r_o_l == -1) { if(op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if(op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) sub_t[tid] += mp_subs_1_o[read_length + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; } if(read_length - s_r_o_r > op_dm_kr1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", read_length -s_r_o_r - op_dm_kr1[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; if(n_cigar1) free(cigar1); if(n_cigar2) free(cigar2); #endif } else { nm_score = dm_op[tid]; #ifdef QUAL_FILT_LV_OUT_SINGLE_END #ifdef CHAR_CP_SINGLE_END for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) computeEditDistanceWithCigar_s_mis_left_mp(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1, mp_subs_1_o + read_length - 1 - s_r_o_l, &(sub_t[tid])); else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1); #else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1); #endif #ifdef CHAR_CP_SINGLE_END for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) computeEditDistanceWithCigar_s_mis_mp(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r, mp_subs_1 + s_r_o_r, &(sub_t[tid])); else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r); #else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r); #endif #else #ifdef CHAR_CP_SINGLE_END for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], mp_subs_1_o + read_length - 1 - s_r_o_l, &(sub_t[tid])); else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid]); #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid]); #endif #ifdef CHAR_CP_SINGLE_END for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], mp_subs_1 + s_r_o_r, &(sub_t[tid])); else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid]); #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid]); #endif #endif //deal with front and back lv cigar m_m_n = s_r_o_r - s_r_o_l - 1; strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok (cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; if((s_r_o_l != -1) && (s_r_o_r != read_length)) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if(s_r_o_l == -1) { if(b_cigar[pchl] == 'M') sn = sprintf(cigar_p1, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); else sn = sprintf(cigar_p1, "%uM%s", m_m_n, b_cigar); snt += sn; } else { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; } #ifdef CIGAR_LEN_ERR cigar_len = 0; s_o_tmp = 0; cigar_len_tmp = 0; strncpy(cigar_tmp, cigar_p1, snt); cigar_tmp[snt] = '\0'; pch_tmp = strtok_r(cigar_tmp,"DMIS", &saveptr_tmp); while (pch_tmp != NULL) { pchl_tmp = strlen(pch_tmp); s_o_tmp += (pchl_tmp + 1); if(cigar_p1[s_o_tmp - 1] != 'D') { cigar_len_tmp = atoi(pch_tmp); cigar_len += cigar_len_tmp; } pch_tmp = strtok_r(NULL, "DMIS", &saveptr_tmp); } if(read_length != cigar_len) { if(read_length < cigar_len) { cigar_len_re = cigar_len_tmp - (cigar_len - read_length); if(cigar_len_re > 0) sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); else if(cigar_len_re == 0) sprintf(cigar_p1 + snt - sn, "\0"); else strcpy(cigar_p1, cigar_m[tid]); } else { cigar_len_re = cigar_len_tmp + (read_length - cigar_len); sprintf(cigar_p1 + snt - sn, "%u%c", cigar_len_re, cigar_p1[snt - 1]); } } #endif #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos1 = sam_pos1 + i_n1 - d_n1 + s_offset1; } #ifdef MAPPING_QUALITY_SINGLE_END if(mp_flag) { sam_qual1 = sub_t[tid]; } #endif #ifdef OUTPUT_ARR seqio[seqi].flag1 = sam_flag1; seqio[seqi].chr_re = chr_re; seqio[seqi].pos1 = sam_pos1; strcpy(pr_cigar1_buffer[seqi], cigar_p1); seqio[seqi].cigar1 = pr_cigar1_buffer[seqi]; seqio[seqi].nm1 = nm_score; if(sam_flag1 == 0) { seqio[seqi].seq1 = seqio[seqi].read_seq1; } else { #ifdef CHAR_CP_SINGLE_END for(sam_seq_i = 0; sam_seq_i < read_length; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #endif strcpy(read_rev_buffer[seqi], sam_seq1); read_rev_buffer[seqi][read_length] = '\0'; seqio[seqi].seq1 = read_rev_buffer[seqi]; strrev1(qual1_buffer[seqi]); } #endif } xa_i = 0; for(va_cnt_i = 1; va_cnt_i < v_cnt; va_cnt_i++) { #ifdef ALTER_DEBUG_SINGLE_END v_cnt_i = seed_length_arr[tid][va_cnt_i].index; #else v_cnt_i = va_cnt_i; #endif x = op_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos1 = op_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; chr_res[tid][xa_i] = chr_re; if(op_rc[tid][v_cnt_i] == 0) { #ifdef CHAR_CP_SINGLE_END read_bit_1[tid] = read_bit1[tid][0]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_LV_OUT_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif } else { #ifdef CHAR_CP_SINGLE_END read_bit_1[tid] = read_bit1[tid][1]; #else for(sam_seq_i = 0; sam_seq_i < read_length; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #endif #ifdef QUAL_FILT_LV_OUT_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif } d_n1 = 0; i_n1 = 0; lv_re1f = dm_op[tid]; s_offset1 = 0; s_r_o_l = op_dm_l1[tid][v_cnt_i]; s_r_o_r = op_dm_r1[tid][v_cnt_i]; if((s_r_o_l == 0) && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m[tid]); } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < op_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kl1[tid][v_cnt_i], read_char[tid], op_dm_kl1[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr1[tid][v_cnt_i], read_char2[tid], op_dm_kr1[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if(n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if(n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if(s_r_o_l >= op_dm_kl1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", s_r_o_l + 1 - op_dm_kl1[tid][v_cnt_i]); snt += sn; } if((s_r_o_l != -1) && (s_r_o_r != read_length)) { if((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if(op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if(op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if(s_r_o_l == -1) { if(op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if(op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) ++nm_score; x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; } if(read_length - s_r_o_r > op_dm_kr1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", read_length - s_r_o_r - op_dm_kr1[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; lv_re1f = nm_score; if(n_cigar1) free(cigar1); if(n_cigar2) free(cigar2); #endif } else { #ifdef QUAL_FILT_LV_OUT_SINGLE_END #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1); #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r); #else #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid]); #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((op_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - op_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid]); #endif //deal with front and back lv cigar m_m_n = s_r_o_r - s_r_o_l - 1; strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok (cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; if((s_r_o_l != -1) && (s_r_o_r != read_length)) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if(s_r_o_l == -1) { if(b_cigar[pchl] == 'M') sn = sprintf(cigar_p1, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); else sn = sprintf(cigar_p1, "%uM%s", m_m_n, b_cigar); snt += sn; } else { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; } sam_pos1 = sam_pos1 + i_n1 - d_n1; } if(op_rc[tid][v_cnt_i] == 0) { xa_d1s[tid][xa_i] = '+'; } else { xa_d1s[tid][xa_i] = '-'; } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos1s[tid][xa_i] = (uint32_t )sam_pos1 + s_offset1; strcpy(cigar_p1s[tid][xa_i], cigar_p1); lv_re1s[tid][xa_i] = lv_re1f; xa_i++; } lv_re1f = dm_ops[tid]; #ifdef ALT_ALL for(v_cnt_i = 0; (v_cnt_i < vs_cnt); v_cnt_i++) #else for(v_cnt_i = 0; (v_cnt_i < vs_cnt) && (v_cnt < 2) && (dm_op[tid] + 3 > dm_ops[tid]); v_cnt_i++) #endif { x = ops_vector_pos1[tid][v_cnt_i]; low = 0; high = chr_file_n - 1; while ( low <= high ) { mid = (low + high) >> 1; if(x < (chr_end_n[mid])) { high = mid - 1; } else if(x > (chr_end_n[mid])) { low = mid + 1; } else { chr_re = mid; break; } chr_re = low; } sam_pos1 = ops_vector_pos1[tid][v_cnt_i] - chr_end_n[chr_re - 1] + 1; chr_res[tid][xa_i] = chr_re; if(ops_rc[tid][v_cnt_i] == 0) { #ifdef CHAR_CP_SINGLE_END read_bit_1[tid] = read_bit1[tid][0]; #else strcpy(sam_seq1, seqio[seqi].read_seq1); #endif #ifdef QUAL_FILT_LV_OUT_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][0]; qual_filt_lv_1_o = qual_filt_lv1[tid][1]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) { mp_subs_1 = mp_subs1[tid][0]; mp_subs_1_o = mp_subs1[tid][1]; } #endif } else { #ifdef CHAR_CP_SINGLE_END read_bit_1[tid] = read_bit1[tid][1]; #else for(sam_seq_i = 0; sam_seq_i < read_length; sam_seq_i++) sam_seq1[sam_seq_i] = Dna5Tochar[charToDna5n[seqio[seqi].read_seq1[sam_seq_i]] ^ 0X3]; sam_seq1[sam_seq_i] = '\0'; strrev1(sam_seq1); #endif #ifdef QUAL_FILT_LV_OUT_SINGLE_END qual_filt_lv_1 = qual_filt_lv1[tid][1]; qual_filt_lv_1_o = qual_filt_lv1[tid][0]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) { mp_subs_1 = mp_subs1[tid][1]; mp_subs_1_o = mp_subs1[tid][0]; } #endif } d_n1 = 0; i_n1 = 0; s_offset1 = 0; s_r_o_l = ops_dm_l1[tid][v_cnt_i]; s_r_o_r = ops_dm_r1[tid][v_cnt_i]; #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] = 0; #endif if(s_r_o_l && (s_r_o_r == 0)) { strcpy(cigar_p1, cigar_m[tid]); #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) { for (bit_char_i = 0, read_b_i = 32; bit_char_i < read_length; bit_char_i++, read_b_i++) if(((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3) != ((ops_vector_seq1[tid][v_cnt_i][read_b_i >> 5] >> ((31 - (read_b_i & 0X1f)) << 1)) & 0X3)) { sub_t[tid] += mp_subs_1[bit_char_i]; } } #endif } else //indel { if((cir_n == cir_fix_n) && (local_ksw)) { #ifdef KSW_ALN #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i >= 0 read_char[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; read_b_i < ops_dm_kl1[tid][v_cnt_i]; bit_char_i--, read_b_i++)//bit_char_i > -1 ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(ops_dm_kl1[tid][v_cnt_i], read_char[tid], ops_dm_kl1[tid][v_cnt_i], ali_ref_seq[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar1, &cigar1); #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < ops_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length read_char2[tid][read_b_i] = charToDna5n[sam_seq1[bit_char_i]]; #endif for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; read_b_i < op_dm_kr1[tid][v_cnt_i]; bit_char_i++, read_b_i++)//bit_char_i < read_length + 64 ali_ref_seq2[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); ksw_global(op_dm_kr1[tid][v_cnt_i], read_char2[tid], op_dm_kr1[tid][v_cnt_i], ali_ref_seq2[tid], 5, mat, gapo_score, gape_score, band_with, &n_cigar2, &cigar2); m_m_n = s_r_o_r - s_r_o_l - 1; nm_score = 0; snt = 0; if(n_cigar1) { op_score1 = cigar1[0]&0xf; len_score1 = cigar1[0]>>4; } else op_score1 = 3; if(n_cigar2) { op_score2 = cigar2[0]&0xf; len_score2 = cigar2[0]>>4; } else op_score2 = 3; if(s_r_o_l >= ops_dm_kl1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", s_r_o_l + 1 - ops_dm_kl1[tid][v_cnt_i]); snt += sn; } if((s_r_o_l != -1) && (s_r_o_r != read_length)) { if((op_score1 == 0) && (op_score2 == 0)) { k_start1 = 0; k_start2 = 1; k_middle = len_score1 + len_score2 + m_m_n; } else if(op_score1 == 0) { k_start1 = 0; k_start2 = 0; k_middle = len_score1 + m_m_n; } else if(op_score2 == 0) { k_start1 = -1; k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start1 = -1; k_start2 = 0; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1_o[read_length + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else if(s_r_o_l == -1) { if(op_score2 == 0) { k_start2 = 1; k_middle = len_score2 + m_m_n; } else { k_start2 = 0; k_middle = m_m_n; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; x_score = y_score = 0; for (bit_char_i = k_start2; bit_char_i < n_cigar2; bit_char_i++) { op_score = cigar2[bit_char_i]&0xf; len_score = cigar2[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char2[tid][x_score + read_b_i] != ali_ref_seq2[tid][y_score + read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1[s_r_o_r + x_score + read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score; } } else { if(op_score1 == 0) { k_start1 = 0; k_middle = len_score1 + m_m_n; } else { k_start1 = -1; k_middle = m_m_n; } x_score = y_score = 0; for (bit_char_i = n_cigar1 - 1; bit_char_i > k_start1; bit_char_i--) { op_score = cigar1[bit_char_i]&0xf; len_score = cigar1[bit_char_i]>>4; sn = sprintf(cigar_p1 + snt, "%d%c", len_score, ksw_cigars[op_score]); snt += sn; if (op_score == 0) // match { for (read_b_i = 0; read_b_i < len_score; ++read_b_i) if (read_char[tid][n_cigar1 - 1 - x_score - read_b_i] != ali_ref_seq[tid][n_cigar1 - 1 - y_score - read_b_i]) { #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) sub_t[tid] += mp_subs_1_o[read_length + n_cigar1 - s_r_o_l - 2 - x_score - read_b_i]; #endif ++nm_score; } x_score += len_score; y_score += len_score; } else if (op_score == 1) x_score += len_score, nm_score += len_score, i_n1 += len_score; else if (op_score == 2) y_score += len_score, nm_score += len_score, d_n1 += len_score; } sn = sprintf(cigar_p1 + snt, "%dM", k_middle); snt += sn; } if(read_length - s_r_o_r > ops_dm_kr1[tid][v_cnt_i]) { sn = sprintf(cigar_p1 + snt, "%dS", read_length - s_r_o_r - ops_dm_kr1[tid][v_cnt_i]); snt += sn; } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; lv_re1f = nm_score; if(n_cigar1) free(cigar1); if(n_cigar2) free(cigar2); #endif } else { #ifdef QUAL_FILT_LV_OUT_SINGLE_END #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) computeEditDistanceWithCigar_s_mis_left_mp(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1, mp_subs_1_o + read_length - 1 - s_r_o_l, &(sub_t[tid])); else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1); #else computeEditDistanceWithCigar_s_mis_left(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], qual_filt_lv_1_o + read_length - 1 - s_r_o_l, &s_offset1); #endif #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) computeEditDistanceWithCigar_s_mis_mp(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - ops_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r, mp_subs_1 + s_r_o_r, &(sub_t[tid])); else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - ops_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r); #else computeEditDistanceWithCigar_s_mis(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - ops_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], qual_filt_lv_1 + s_r_o_r); #endif #else #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > - 1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_l, read_b_i = 0; bit_char_i >= 0; bit_char_i--, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_l, read_b_i = 0; bit_char_i > -1; bit_char_i--, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid], mp_subs_1_o + read_length - 1 - s_r_o_l, &(sub_t[tid])); else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid]); #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 33 + s_r_o_l, read_char[tid], s_r_o_l + 1, lv_k, cigarBuf1, f_cigarn, L[tid]); #endif #ifdef CHAR_CP_SINGLE_END for (bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = ((read_bit_1[tid][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); for (bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = ((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3); #else for(bit_char_i = s_r_o_r, read_b_i = 0; bit_char_i < read_length; bit_char_i++, read_b_i++) read_char[tid][read_b_i] = sam_seq1[bit_char_i]; for(bit_char_i = 32 + s_r_o_r, read_b_i = 0; bit_char_i < read_length + 64; bit_char_i++, read_b_i++) ali_ref_seq[tid][read_b_i] = Dna5Tochar[((ops_vector_seq1[tid][v_cnt_i][bit_char_i >> 5] >> ((31 - (bit_char_i & 0X1f)) << 1)) & 0X3)]; #endif #ifdef MAPPING_QUALITY_SINGLE_END if((mp_flag) && (v_cnt_i == 0)) computeEditDistanceWithCigar_s_mp(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - ops_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid], mp_subs_1 + s_r_o_r, &(sub_t[tid])); else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - ops_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid]); #else computeEditDistanceWithCigar_s(ali_ref_seq[tid], 32 + read_length - s_r_o_r, read_char[tid], read_length - ops_dm_r1[tid][v_cnt_i], lv_k, cigarBuf2, f_cigarn, L[tid]); #endif #endif //deal with front and back lv cigar m_m_n = s_r_o_r - s_r_o_l - 1; strncpy(str_o, cigarBuf1, f_cigarn); s_o = 0; f_c = 0; pch = strtok_r(cigarBuf1,"DMIS", &saveptr); while (pch != NULL) { pchl = strlen(pch); f_cigar[f_cigarn - f_c - 2] = atoi(pch); s_o += (pchl + 1); f_cigar[f_cigarn - f_c - 1] = str_o[s_o - 1]; f_c += 2; if(str_o[s_o - 1] == 'D') d_n1 += atoi(pch); if(str_o[s_o - 1] == 'I') i_n1 += atoi(pch); pch = strtok_r(NULL, "DMIS", &saveptr); } strncpy(b_cigar, cigarBuf2, f_cigarn); pch = strtok (cigarBuf2,"DMIS"); if(pch != NULL) pchl = strlen(pch); snt = 0; if((s_r_o_l != -1) && (s_r_o_r != read_length)) { if((f_cigar[f_cigarn - 1] == 'M') && (b_cigar[pchl] == 'M')) { f_cigar[f_cigarn - 2] += (m_m_n + atoi(pch)); for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s", b_cigar + pchl + 1); snt += sn; } else if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%s",b_cigar); snt += sn; } else if(b_cigar[pchl] == 'M') { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); snt += sn; } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM%s", m_m_n, b_cigar); snt += sn; } } else if(s_r_o_l == -1) { if(b_cigar[pchl] == 'M') sn = sprintf(cigar_p1, "%uM%s", m_m_n + atoi(pch), b_cigar + pchl + 1); else sn = sprintf(cigar_p1, "%uM%s", m_m_n, b_cigar); snt += sn; } else { if(f_cigar[f_cigarn - 1] == 'M') { f_cigar[f_cigarn - 2] += m_m_n; for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } } else { for(f_i = 0; f_i < f_c; f_i += 2) { sn = sprintf(cigar_p1 + snt, "%u%c", f_cigar[f_cigarn - f_c + f_i], f_cigar[f_cigarn + 1 - f_c + f_i]); snt += sn; } sn = sprintf(cigar_p1 + snt, "%uM", m_m_n); snt += sn; } } //sn = sprintf(cigar_p1 + snt, "\0"); //snt += sn; } sam_pos1 = sam_pos1 + i_n1 - d_n1; } if(ops_rc[tid][v_cnt_i] == 0) { xa_d1s[tid][xa_i] = '+'; } else { xa_d1s[tid][xa_i] = '-'; } #ifdef NO_S_OFF s_offset1 = 0; #endif sam_pos1s[tid][xa_i] = (uint32_t )sam_pos1 + s_offset1; strcpy(cigar_p1s[tid][xa_i], cigar_p1); lv_re1s[tid][xa_i] = lv_re1f; xa_i++; } seqio[seqi].v_cnt = v_cnt; if(v_cnt > 0) { #ifdef MAPPING_QUALITY if(mp_flag) { if(xa_i) { log_tmp = log(vs_cnt); sam_qual1 = (sam_qual1 - sub_t[tid] - log_tmp) * 3.434; sam_qual1 = (sam_qual1 > 2 ? sam_qual1 : 2); #ifdef QUAL_20 sam_qual1 = (sam_qual1 < 20 ? 20 : sam_qual1); #endif sam_qual1 = (sam_qual1 > 60 ? 60 : sam_qual1); } else { sam_qual1 = 60; } } #endif seqio[seqi].qualc1 = sam_qual1; seqio[seqi].xa_n = xa_i; if(xa_i > 0) { memcpy(chr_res_buffer[seqi], chr_res[tid], xa_i << 2); seqio[seqi].chr_res = chr_res_buffer[seqi]; memcpy(xa_d1s_buffer[seqi], xa_d1s[tid], xa_i); seqio[seqi].xa_d1s = xa_d1s_buffer[seqi]; memcpy(sam_pos1s_buffer[seqi], sam_pos1s[tid], xa_i << 2); seqio[seqi].sam_pos1s = sam_pos1s_buffer[seqi]; memcpy(lv_re1s_buffer[seqi], lv_re1s[tid], xa_i << 2); seqio[seqi].lv_re1s = lv_re1s_buffer[seqi]; for(v_cnt_i = 0; v_cnt_i < xa_i; v_cnt_i++) { pos_l = strlen(cigar_p1s[tid][v_cnt_i]) + 1; if((seqio[seqi].cigar_p1s[v_cnt_i] = (char* )calloc(pos_l, 1)) == NULL) exit(1);// memcpy(seqio[seqi].cigar_p1s[v_cnt_i], cigar_p1s[tid][v_cnt_i], pos_l - 1); } } } else { #ifdef OUTPUT_ARR seqio[seqi].xa_n = 0; seqio[seqi].flag1 = 4; seqio[seqi].chr_re = chr_file_n; seqio[seqi].pos1 = 0; seqio[seqi].qualc1 = 0; strcpy(pr_cigar1_buffer[seqi], "*"); seqio[seqi].cigar1 = pr_cigar1_buffer[seqi]; seqio[seqi].seq1 = seqio[seqi].read_seq1; #endif } } }
wokalski/Distraction-Free-Xcode-plugin
Archived/v1/WCDistractionFreeXcodePlugin/Headers/Frameworks/IDEKit/IDETemplateSection.h
<gh_stars>10-100 // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #import "NSObject.h" #import "IDEKeyDrivenNavigableItemRepresentedObject.h" @class DVTDocumentLocation, DVTFileDataType, DVTPlatform, IDEFileReference, NSArray, NSImage, NSMutableDictionary, NSString; @interface IDETemplateSection : NSObject <IDEKeyDrivenNavigableItemRepresentedObject> { NSMutableDictionary *_templateCategoriesByName; NSArray *_categories; DVTPlatform *_platform; } + (id)keyPathsForValuesAffectingWillChangeDeviceSoftwareVersion; @property(retain) DVTPlatform *platform; // @synthesize platform=_platform; - (void).cxx_destruct; @property(readonly) BOOL navigableItem_isMajorGroup; @property(readonly) NSImage *navigableItem_image; @property(readonly) NSString *navigableItem_name; @property(readonly) NSArray *templates; @property(readonly) NSArray *categories; // @synthesize categories=_categories; - (void)sortAllCategories; - (void)addTemplate:(id)arg1; - (id)categoryWithName:(id)arg1; @property(readonly) NSString *sectionIdentifier; - (id)init; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) DVTDocumentLocation *navigableItem_contentDocumentLocation; @property(readonly) DVTFileDataType *navigableItem_documentType; @property(readonly) IDEFileReference *navigableItem_fileReference; @property(readonly) NSString *navigableItem_groupIdentifier; @property(readonly) BOOL navigableItem_isLeaf; @property(readonly) NSString *navigableItem_toolTip; @property(readonly) Class superclass; @end
openharmony-sig-ci/appexecfwk_standard
services/bundlemgr/include/ipc/installd_interface.h
<filename>services/bundlemgr/include/ipc/installd_interface.h<gh_stars>1-10 /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPC_INSTALLD_INTERFACE_H #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPC_INSTALLD_INTERFACE_H #include <string> #include <vector> #include "iremote_broker.h" #include "appexecfwk_errors.h" namespace OHOS { namespace AppExecFwk { class IInstalld : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.Installd"); /** * @brief Create a bundle code directory. * @param bundleDir Indicates the bundle code directory path that to be created. * @return Returns ERR_OK if the bundle directory created successfully; returns error code otherwise. */ virtual ErrCode CreateBundleDir(const std::string &bundleDir) = 0; /** * @brief Remove a bundle code directory. * @param bundleDir Indicates the bundle code directory path that to be removed. * @return Returns ERR_OK if the bundle directory removed successfully; returns error code otherwise. */ virtual ErrCode RemoveBundleDir(const std::string &bundleDir) = 0; /** * @brief Extract the files of a HAP module to the code directory. * @param srcModulePath Indicates the HAP file path. * @param targetPath Indicates the code directory path that the HAP to be extracted to. * @return Returns ERR_OK if the HAP file extracted successfully; returns error code otherwise. */ virtual ErrCode ExtractModuleFiles(const std::string &srcModulePath, const std::string &destPath) = 0; /** * @brief Remove the module directory. * @param moduleDir Indicates the module directory to be removed. * @return Returns ERR_OK if the module directory removed successfully; returns error code otherwise. */ virtual ErrCode RemoveModuleDir(const std::string &moduleDir) = 0; /** * @brief Rename the module directory from temporaily path to the real path. * @param oldPath Indicates the old path name. * @param newPath Indicates the new path name. * @return Returns ERR_OK if the module directory renamed successfully; returns error code otherwise. */ virtual ErrCode RenameModuleDir(const std::string &oldDir, const std::string &newDir) = 0; /** * @brief Create a bundle data directory. * @param bundleDir Indicates the bundle data directory path that to be created. * @param uid Indicates uid to be set to the directory. * @param gid Indicates gid to be set to the directory. * @return Returns ERR_OK if the bundle data directory created successfully; returns error code otherwise. */ virtual ErrCode CreateBundleDataDir(const std::string &bundleDir, const int uid, const int gid) = 0; /** * @brief Remove a bundle data directory. * @param bundleDir Indicates the bundle data directory path that to be removed. * @return Returns ERR_OK if the bundle data directory removed successfully; returns error code otherwise. */ virtual ErrCode RemoveBundleDataDir(const std::string &bundleDataDir) = 0; /** * @brief Create a module and it's abilities data directory. * @param bundleDir Indicates the module data directory path that to be created. * @param abilityDirs Indicates the abilities data directory name that to be created. * @param uid Indicates uid to be set to the directory. * @param gid Indicates gid to be set to the directory. * @return Returns ERR_OK if the data directories created successfully; returns error code otherwise. */ virtual ErrCode CreateModuleDataDir( const std::string &ModuleDir, const std::vector<std::string> &abilityDirs, const int uid, const int gid) = 0; /** * @brief Remove a module data directory. * @param bundleDir Indicates the module data directory path that to be removed. * @return Returns ERR_OK if the module data directory removed successfully; returns error code otherwise. */ virtual ErrCode RemoveModuleDataDir(const std::string &moduleDataDir) = 0; /** * @brief Clean all files in a bundle data directory. * @param bundleDir Indicates the data directory path that to be cleaned. * @return Returns ERR_OK if the data directory cleaned successfully; returns error code otherwise. */ virtual ErrCode CleanBundleDataDir(const std::string &bundleDir) = 0; enum class Message { CREATE_BUNDLE_DIR = 1, REMOVE_BUNDLE_DIR, EXTRACT_MODULE_FILES, REMOVE_MODULE_DIR, RENAME_MODULE_DIR, CREATE_BUNDLE_DATA_DIR, REMOVE_BUNDLE_DATA_DIR, CREATE_MODULE_DATA_DIR, REMOVE_MODULE_DATA_DIR, CLEAN_BUNDLE_DATA_DIR, }; }; } // namespace AppExecFwk } // namespace OHOS #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPC_INSTALLD_INTERFACE_H
chrisuehlinger/portfolio-gatsby
src/components/homepage/Talks.js
import React from 'react' import { StaticQuery, graphql } from "gatsby" import HomepageWaypoint from './parts/HomepageWaypoint'; import ShowCard from './parts/ShowCard'; import './talks.scss' const Talks = () => ( <HomepageWaypoint zone="TALKS"> <div className="talks-page" id="talks"> <h2>Talks</h2> <StaticQuery query={graphql` query TalkQuery { allTalksYaml { nodes { company description id title url clips { height id src type width image { childImageSharp { fluid(maxWidth: 300) { ...GatsbyImageSharpFluid } } } } } } } `} render={data => data.allTalksYaml.nodes.map(talk => <ShowCard key={talk.id} {...talk}/>) }/> </div> </HomepageWaypoint> ); export default Talks
shantyps/openosrs-dev
runelite-api/src/main/java/net/runelite/api/events/NameChangeEvent.java
<gh_stars>1-10 package net.runelite.api.events; import lombok.Data; import net.runelite.api.Actor; /** * @author Kris | 07/01/2022 */ @Data public class NameChangeEvent { private final Actor actor; private final String oldName; private final String newName; }
askmohanty/metasfresh
misc/services/mobile-webui/mobile-webui-frontend/src/reducers/wfProcesses_status/confirmation.js
<gh_stars>0 import * as types from '../../constants/UserConfirmationTypes'; import * as CompleteStatus from '../../constants/CompleteStatus'; import { updateUserEditable } from './utils'; import { registerHandler } from './activityStateHandlers'; const COMPONENT_TYPE = 'common/confirmButton'; export const activityUserConfirmationReducer = ({ draftState, action }) => { switch (action.type) { case types.SET_ACTIVITY_USER_CONFIRMED: { console.log('SET_ACTIVITY_USER_CONFIRMED: ', action); const { wfProcessId, activityId } = action.payload; const draftWFProcess = draftState[wfProcessId]; const draftActivity = draftWFProcess.activities[activityId]; draftActivity.dataStored.confirmed = true; draftActivity.dataStored.completeStatus = computeActivityStatus({ confirmed: draftActivity.dataStored.confirmed, }); updateUserEditable({ draftWFProcess }); return draftState; } default: { return draftState; } } }; const computeActivityStatus = ({ confirmed }) => { return confirmed ? CompleteStatus.COMPLETED : CompleteStatus.NOT_STARTED; }; registerHandler({ componentType: COMPONENT_TYPE, computeActivityDataStoredInitialValue: ({ componentProps }) => { const confirmed = !!componentProps.confirmed; return { confirmed: confirmed, completeStatus: computeActivityStatus({ confirmed }) }; }, });
npillmayer/gotype
engine/khipu/linebreak/firstfit/firstfit_test.go
<reponame>npillmayer/gotype<gh_stars>1-10 package firstfit import ( "bytes" "io" "io/ioutil" "strings" "testing" "github.com/npillmayer/gotype/core/config/gtrace" "github.com/npillmayer/gotype/core/config/tracing" "github.com/npillmayer/gotype/core/config/tracing/gotestingadapter" "github.com/npillmayer/gotype/core/dimen" "github.com/npillmayer/gotype/core/parameters" "github.com/npillmayer/gotype/engine/khipu" "github.com/npillmayer/gotype/engine/khipu/linebreak" ) var graphviz = false // global switch for GraphViz DOT output func TestBuffer(t *testing.T) { //gtrace.CoreTracer = gologadapter.New() gtrace.CoreTracer = gotestingadapter.New() teardown := gotestingadapter.RedirectTracing(t) defer teardown() lb, _ := newTestLinebreaker(t, "Hello World!", 20) k, ok := lb.peek() if !ok || k.Type() != khipu.KTTextBox { //t.Logf("lb.pos=%d, lb.mark=%d", lb.pos, lb.check) t.Logf("lb.pos=%d", lb.pos) t.Errorf("expected the first knot to be TextBox('Hello'), is %v", k) } if knot := lb.next(); k != knot { t.Errorf("first knot is %v, re-read knot is %v", k, knot) } } func TestBacktrack(t *testing.T) { //gtrace.CoreTracer = gologadapter.New() gtrace.CoreTracer = gotestingadapter.New() teardown := gotestingadapter.RedirectTracing(t) defer teardown() lb, _ := newTestLinebreaker(t, "the quick brown fox jumps over the lazy dog.", 30) k := lb.next() lb.checkpoint() lb.next() lb.next() lb.next() knot := lb.backtrack() if k != knot { t.Errorf("remembered start knot is %v, backtracked knot is %v", k, knot) } k = lb.next() lb.checkpoint() knot = lb.backtrack() if k != knot { t.Errorf("remembered knot is %v, backtracked knot is %v", k, knot) } } func TestLinebreak(t *testing.T) { // gtrace.CoreTracer = gologadapter.New() gtrace.CoreTracer = gotestingadapter.New() teardown := gotestingadapter.RedirectTracing(t) defer teardown() lb, kh := newTestLinebreaker(t, "the quick brown fox jumps over the lazy dog.", 30) breakpoints, err := lb.FindBreakpoints() if err != nil { t.Errorf(err.Error()) } if len(breakpoints)-1 != 2 { t.Errorf("exptected 'princess' to occupy 2 lines, got %d", len(breakpoints)-1) } t.Logf("# Paragraph with %d lines: %v", len(breakpoints)-1, breakpoints) t.Logf(" |---------+---------+---------+|") j := 0 for i := 1; i < len(breakpoints); i++ { // t.Logf("%3d: %s", i, kh.Text(j, breakpoints[i].Position())) text := kh.Text(j, breakpoints[i].Position()) t.Logf("%3d: %-30s|", i, justify(text, 30, i%2 == 0)) j = breakpoints[i].Position() } } var princess = `In olden times when wishing still helped one, there lived a king whose daughters were all beautiful; and the youngest was so beautiful that the sun itself, which has seen so much, was astonished whenever it shone in her face. Close by the king's castle lay a great dark forest, and under an old lime-tree in the forest was a well, and when the day was very warm, the king's child went out into the forest and sat down by the side of the cool fountain; and when she was bored she took a golden ball, and threw it up on high and caught it; and this ball was her favorite plaything.` func TestPrincess(t *testing.T) { // gtrace.CoreTracer = gologadapter.New() gtrace.CoreTracer = gotestingadapter.New() teardown := gotestingadapter.RedirectTracing(t) defer teardown() lb, kh := newTestLinebreaker(t, princess, 45) kh.AppendKnot(khipu.Penalty(-10000)) // TODO: add parfillskip breakpoints, err := lb.FindBreakpoints() if err != nil { t.Errorf(err.Error()) } if len(breakpoints)-1 != 14 { t.Errorf("exptected 'princess' to occupy 14 lines, got %d", len(breakpoints)-1) } t.Logf("# Paragraph with %d lines: %v", len(breakpoints)-1, breakpoints) t.Logf(" |---------+---------+---------+---------+-----|") j := 0 for i := 1; i < len(breakpoints); i++ { // t.Logf("%3d: %s", i, kh.Text(j, breakpoints[i].Position())) text := kh.Text(j, breakpoints[i].Position()) t.Logf("%3d: %-45s|", i, justify(text, 45, i%2 == 0)) j = breakpoints[i].Position() } } // --- Helpers ---------------------------------------------------------- func newTestLinebreaker(t *testing.T, text string, len int) (*linebreaker, *khipu.Khipu) { kh, cursor, _ := setupFFTest(t, text, false) parshape := linebreak.RectangularParShape(dimen.Dimen(len) * 10 * dimen.BP) lb, err := newLinebreaker(cursor, parshape, nil) if err != nil { t.Error(err) } return lb, kh } func setupFFTest(t *testing.T, paragraph string, hyphens bool) (*khipu.Khipu, linebreak.Cursor, io.Writer) { gtrace.CoreTracer.SetTraceLevel(tracing.LevelError) regs := parameters.NewTypesettingRegisters() if hyphens { regs.Push(parameters.P_MINHYPHENLENGTH, 3) // allow hyphenation } else { regs.Push(parameters.P_MINHYPHENLENGTH, 100) // inhibit hyphenation } kh := khipu.KnotEncode(strings.NewReader(paragraph), nil, regs) if kh == nil { t.Errorf("no Khipu to test; input is %s", paragraph) } //kh.AppendKnot(khipu.Penalty(linebreak.InfinityMerits)) cursor := linebreak.NewFixedWidthCursor(khipu.NewCursor(kh), 10*dimen.BP, 0) var dotfile io.Writer var err error if graphviz { dotfile, err = ioutil.TempFile(".", "knuthplass-*.dot") if err != nil { t.Errorf(err.Error()) } } gtrace.CoreTracer.SetTraceLevel(tracing.LevelDebug) return kh, cursor, dotfile } // ------------------------------------------------------------- // crude implementation just for testing func justify(text string, l int, even bool) string { t := strings.Trim(text, " \t\n") d := l - len(t) if d == 0 { return t // fit } else if d < 0 { // overfull box return text + "\u25ae" } s := strings.Fields(text) if len(s) == 1 { return text } var b bytes.Buffer W := 0 // length of all words for _, w := range s { W += len(w) } d = l - W // amount of WS to distribute ws := d / (len(s) - 1) r := d - ws*(len(s)-1) + 1 b.WriteString(s[0]) if even { for j := 1; j < r; j++ { for i := 0; i < ws+1; i++ { b.WriteString(" ") } b.WriteString(s[j]) } for j := r; j < len(s); j++ { for i := 0; i < ws; i++ { b.WriteString(" ") } b.WriteString(s[j]) } } else { for j := 1; j <= len(s)-r; j++ { for i := 0; i < ws; i++ { b.WriteString(" ") } b.WriteString(s[j]) } for j := len(s) - r + 1; j < len(s); j++ { for i := 0; i < ws+1; i++ { b.WriteString(" ") } b.WriteString(s[j]) } } return b.String() }
lishangwu/nodejs-mmall
src/dao/ShippingDao.js
<filename>src/dao/ShippingDao.js import { Const } from '../common' import { sequelize, Sequelize } from '../db/db' const Op = Sequelize.Op const model = require('../db/model') const Shipping = model[Const.Entity.Shipping] class ShippingDao { async insert(shipping) { return await Shipping.create(shipping) } async deleteByShippingIdUserId(userid, shippingId) { return await Shipping.destroy({ where: { user_id: userid, id: shippingId } }) } async updateByShipping(shipping){ return await Shipping.update( shipping, { where: {id:shipping.id, user_id:shipping.user_id} } ) } async selectByShippingIdUserId(userId,shippingId){ return await Shipping.findOne({ where: { id: shippingId, user_id: userId } }) } async selectByUserId(userId){ return await Shipping.findAll({ where: { user_id: userId } }) } async selectByPrimaryKey(shipping_id){ return await Shipping.findOne({ where:{id: shipping_id} }) } } module.exports = { ShippingDao }
RobottDog/dcos-chronos
src/js/components/ConfigurationMapLabel.js
import React from "react"; const ConfigurationMapLabel = props => { return ( <div className="configuration-map-label"> {props.children} </div> ); }; module.exports = ConfigurationMapLabel;
NicholsTyler/cse_335
AquaLand/AquaLand/AquaLand/Fish.cpp
<gh_stars>0 /** * \file Fish.cpp * * \author <NAME> */ #include "pch.h" #include "Fish.h" #include "Aquarium.h" /// Maximum speed in the X direction in /// in pixels per second const double MaxSpeedX = 50; /// Maximum speed in the Y direction in /// in pixels per second const double MaxSpeedY = 50; /** * Constructor * \param aquarium The aquarium we are in * \param filename Filename for the image we use */ CFish::CFish(CAquarium* aquarium, const std::wstring& filename) : CItem(aquarium, filename) { mSpeedX = ((double)rand() / RAND_MAX) * MaxSpeedX; mSpeedY = ((double)rand() / RAND_MAX) * MaxSpeedY; } /** * Handle updates in time of our fish * * This is called before we draw and allows us to * move our fish. We add our speed times the amount * of time that has elapsed. * \param elapsed Time elapsed since the class call */ void CFish::Update(double elapsed) { SetLocation(GetX() + mSpeedX * elapsed, GetY() + mSpeedY * elapsed); AdjustX(); AdjustY(); } /** * Handle needed x adjustments for fish * * This is called after updating fish location * allowing for needed adjustments to image orientation * and speed on the x axis. */ void CFish::AdjustX() { // X Location of fish + 10 pixels + half its width double fishRight = GetX() + 10 + (GetItemWidth() / 2); // X Location of fish - 10 pixels - half its width double fishLeft = GetX() - 10 - (GetItemWidth() / 2); if (mSpeedX > 0 && fishRight >= GetAquarium()->GetWidth()) { mSpeedX = -mSpeedX; SetMirror(mSpeedX < 0); } else if (mSpeedX < 0 && fishLeft <= 0) { mSpeedX = -mSpeedX; SetMirror(mSpeedX < 0); } } /** * Handle needed y adjustments for fish * * This is called after updating fish location * allowing for needed adjustments to speed on * the y axis. */ void CFish::AdjustY() { // Y Location of fish + 10 pixels + half its height double fishUp = GetY() + 10 + (GetItemHeight() / 2); // Y Location of fish - 10 pixels - half its height double fishDown = GetY() - 10 - (GetItemHeight() / 2); if (mSpeedY > 0 && fishUp >= GetAquarium()->GetHeight()) { mSpeedY = -mSpeedY; } else if (mSpeedY < 0 && fishDown <= 0) { mSpeedY = -mSpeedY; } } /** * Save this item to an XML node * \param node The node we are going to be a child of * \return the node we created */ std::shared_ptr<xmlnode::CXmlNode> CFish::XmlSave(const std::shared_ptr<xmlnode::CXmlNode>& node) { auto itemNode = node->AddChild(L"item"); itemNode->SetAttribute(L"x", GetX()); itemNode->SetAttribute(L"y", GetY()); itemNode->SetAttribute(L"xSpeed", mSpeedX); itemNode->SetAttribute(L"ySpeed", mSpeedY); return itemNode; } /** * Load the attributes for an item node. * * Override of the base class version. Adds attributes * for x and y speed. * * \param node The Xml node we are loading the item from */ void CFish::XmlLoad(const std::shared_ptr<xmlnode::CXmlNode>& node) { CItem::XmlLoad(node); mSpeedX = node->GetAttributeDoubleValue(L"xSpeed", 0); mSpeedY = node->GetAttributeDoubleValue(L"ySpeed", 0); }
gedorinku/prolab-accounts
infra/record/entries.go
<filename>infra/record/entries.go // Code generated by SQLBoiler (https://github.com/volatiletech/sqlboiler). DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package record import ( "context" "database/sql" "fmt" "reflect" "strconv" "strings" "sync" "time" "github.com/pkg/errors" "github.com/volatiletech/sqlboiler/boil" "github.com/volatiletech/sqlboiler/queries" "github.com/volatiletech/sqlboiler/queries/qm" "github.com/volatiletech/sqlboiler/queries/qmhelper" "github.com/volatiletech/sqlboiler/strmangle" ) // Entry is an object representing the database table. type Entry struct { ID int64 `boil:"id" json:"id" toml:"id" yaml:"id"` Title string `boil:"title" json:"title" toml:"title" yaml:"title"` Description string `boil:"description" json:"description" toml:"description" yaml:"description"` Content string `boil:"content" json:"content" toml:"content" yaml:"content"` Link string `boil:"link" json:"link" toml:"link" yaml:"link"` AuthorID int64 `boil:"author_id" json:"author_id" toml:"author_id" yaml:"author_id"` GUID string `boil:"guid" json:"guid" toml:"guid" yaml:"guid"` ImageURL string `boil:"image_url" json:"image_url" toml:"image_url" yaml:"image_url"` BlogID int64 `boil:"blog_id" json:"blog_id" toml:"blog_id" yaml:"blog_id"` PublishedAt time.Time `boil:"published_at" json:"published_at" toml:"published_at" yaml:"published_at"` CreatedAt time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"` UpdatedAt time.Time `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"` R *entryR `boil:"-" json:"-" toml:"-" yaml:"-"` L entryL `boil:"-" json:"-" toml:"-" yaml:"-"` } var EntryColumns = struct { ID string Title string Description string Content string Link string AuthorID string GUID string ImageURL string BlogID string PublishedAt string CreatedAt string UpdatedAt string }{ ID: "id", Title: "title", Description: "description", Content: "content", Link: "link", AuthorID: "author_id", GUID: "guid", ImageURL: "image_url", BlogID: "blog_id", PublishedAt: "published_at", CreatedAt: "created_at", UpdatedAt: "updated_at", } // Generated where var EntryWhere = struct { ID whereHelperint64 Title whereHelperstring Description whereHelperstring Content whereHelperstring Link whereHelperstring AuthorID whereHelperint64 GUID whereHelperstring ImageURL whereHelperstring BlogID whereHelperint64 PublishedAt whereHelpertime_Time CreatedAt whereHelpertime_Time UpdatedAt whereHelpertime_Time }{ ID: whereHelperint64{field: `id`}, Title: whereHelperstring{field: `title`}, Description: whereHelperstring{field: `description`}, Content: whereHelperstring{field: `content`}, Link: whereHelperstring{field: `link`}, AuthorID: whereHelperint64{field: `author_id`}, GUID: whereHelperstring{field: `guid`}, ImageURL: whereHelperstring{field: `image_url`}, BlogID: whereHelperint64{field: `blog_id`}, PublishedAt: whereHelpertime_Time{field: `published_at`}, CreatedAt: whereHelpertime_Time{field: `created_at`}, UpdatedAt: whereHelpertime_Time{field: `updated_at`}, } // EntryRels is where relationship names are stored. var EntryRels = struct { Author string Blog string }{ Author: "Author", Blog: "Blog", } // entryR is where relationships are stored. type entryR struct { Author *User Blog *Blog } // NewStruct creates a new relationship struct func (*entryR) NewStruct() *entryR { return &entryR{} } // entryL is where Load methods for each relationship are stored. type entryL struct{} var ( entryColumns = []string{"id", "title", "description", "content", "link", "author_id", "guid", "image_url", "blog_id", "published_at", "created_at", "updated_at"} entryColumnsWithoutDefault = []string{"title", "description", "content", "link", "author_id", "guid", "image_url", "blog_id", "published_at", "created_at", "updated_at"} entryColumnsWithDefault = []string{"id"} entryPrimaryKeyColumns = []string{"id"} ) type ( // EntrySlice is an alias for a slice of pointers to Entry. // This should generally be used opposed to []Entry. EntrySlice []*Entry // EntryHook is the signature for custom Entry hook methods EntryHook func(context.Context, boil.ContextExecutor, *Entry) error entryQuery struct { *queries.Query } ) // Cache for insert, update and upsert var ( entryType = reflect.TypeOf(&Entry{}) entryMapping = queries.MakeStructMapping(entryType) entryPrimaryKeyMapping, _ = queries.BindMapping(entryType, entryMapping, entryPrimaryKeyColumns) entryInsertCacheMut sync.RWMutex entryInsertCache = make(map[string]insertCache) entryUpdateCacheMut sync.RWMutex entryUpdateCache = make(map[string]updateCache) entryUpsertCacheMut sync.RWMutex entryUpsertCache = make(map[string]insertCache) ) var ( // Force time package dependency for automated UpdatedAt/CreatedAt. _ = time.Second // Force qmhelper dependency for where clause generation (which doesn't // always happen) _ = qmhelper.Where ) var entryBeforeInsertHooks []EntryHook var entryBeforeUpdateHooks []EntryHook var entryBeforeDeleteHooks []EntryHook var entryBeforeUpsertHooks []EntryHook var entryAfterInsertHooks []EntryHook var entryAfterSelectHooks []EntryHook var entryAfterUpdateHooks []EntryHook var entryAfterDeleteHooks []EntryHook var entryAfterUpsertHooks []EntryHook // doBeforeInsertHooks executes all "before insert" hooks. func (o *Entry) doBeforeInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryBeforeInsertHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doBeforeUpdateHooks executes all "before Update" hooks. func (o *Entry) doBeforeUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryBeforeUpdateHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doBeforeDeleteHooks executes all "before Delete" hooks. func (o *Entry) doBeforeDeleteHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryBeforeDeleteHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doBeforeUpsertHooks executes all "before Upsert" hooks. func (o *Entry) doBeforeUpsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryBeforeUpsertHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doAfterInsertHooks executes all "after Insert" hooks. func (o *Entry) doAfterInsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryAfterInsertHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doAfterSelectHooks executes all "after Select" hooks. func (o *Entry) doAfterSelectHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryAfterSelectHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doAfterUpdateHooks executes all "after Update" hooks. func (o *Entry) doAfterUpdateHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryAfterUpdateHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doAfterDeleteHooks executes all "after Delete" hooks. func (o *Entry) doAfterDeleteHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryAfterDeleteHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // doAfterUpsertHooks executes all "after Upsert" hooks. func (o *Entry) doAfterUpsertHooks(ctx context.Context, exec boil.ContextExecutor) (err error) { if boil.HooksAreSkipped(ctx) { return nil } for _, hook := range entryAfterUpsertHooks { if err := hook(ctx, exec, o); err != nil { return err } } return nil } // AddEntryHook registers your hook function for all future operations. func AddEntryHook(hookPoint boil.HookPoint, entryHook EntryHook) { switch hookPoint { case boil.BeforeInsertHook: entryBeforeInsertHooks = append(entryBeforeInsertHooks, entryHook) case boil.BeforeUpdateHook: entryBeforeUpdateHooks = append(entryBeforeUpdateHooks, entryHook) case boil.BeforeDeleteHook: entryBeforeDeleteHooks = append(entryBeforeDeleteHooks, entryHook) case boil.BeforeUpsertHook: entryBeforeUpsertHooks = append(entryBeforeUpsertHooks, entryHook) case boil.AfterInsertHook: entryAfterInsertHooks = append(entryAfterInsertHooks, entryHook) case boil.AfterSelectHook: entryAfterSelectHooks = append(entryAfterSelectHooks, entryHook) case boil.AfterUpdateHook: entryAfterUpdateHooks = append(entryAfterUpdateHooks, entryHook) case boil.AfterDeleteHook: entryAfterDeleteHooks = append(entryAfterDeleteHooks, entryHook) case boil.AfterUpsertHook: entryAfterUpsertHooks = append(entryAfterUpsertHooks, entryHook) } } // One returns a single entry record from the query. func (q entryQuery) One(ctx context.Context, exec boil.ContextExecutor) (*Entry, error) { o := &Entry{} queries.SetLimit(q.Query, 1) err := q.Bind(ctx, exec, o) if err != nil { if errors.Cause(err) == sql.ErrNoRows { return nil, sql.ErrNoRows } return nil, errors.Wrap(err, "record: failed to execute a one query for entries") } if err := o.doAfterSelectHooks(ctx, exec); err != nil { return o, err } return o, nil } // All returns all Entry records from the query. func (q entryQuery) All(ctx context.Context, exec boil.ContextExecutor) (EntrySlice, error) { var o []*Entry err := q.Bind(ctx, exec, &o) if err != nil { return nil, errors.Wrap(err, "record: failed to assign all query results to Entry slice") } if len(entryAfterSelectHooks) != 0 { for _, obj := range o { if err := obj.doAfterSelectHooks(ctx, exec); err != nil { return o, err } } } return o, nil } // Count returns the count of all Entry records in the query. func (q entryQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) { var count int64 queries.SetSelect(q.Query, nil) queries.SetCount(q.Query) err := q.Query.QueryRowContext(ctx, exec).Scan(&count) if err != nil { return 0, errors.Wrap(err, "record: failed to count entries rows") } return count, nil } // Exists checks if the row exists in the table. func (q entryQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) { var count int64 queries.SetSelect(q.Query, nil) queries.SetCount(q.Query) queries.SetLimit(q.Query, 1) err := q.Query.QueryRowContext(ctx, exec).Scan(&count) if err != nil { return false, errors.Wrap(err, "record: failed to check if entries exists") } return count > 0, nil } // Author pointed to by the foreign key. func (o *Entry) Author(mods ...qm.QueryMod) userQuery { queryMods := []qm.QueryMod{ qm.Where("id=?", o.AuthorID), } queryMods = append(queryMods, mods...) query := Users(queryMods...) queries.SetFrom(query.Query, "\"users\"") return query } // Blog pointed to by the foreign key. func (o *Entry) Blog(mods ...qm.QueryMod) blogQuery { queryMods := []qm.QueryMod{ qm.Where("id=?", o.BlogID), } queryMods = append(queryMods, mods...) query := Blogs(queryMods...) queries.SetFrom(query.Query, "\"blogs\"") return query } // LoadAuthor allows an eager lookup of values, cached into the // loaded structs of the objects. This is for an N-1 relationship. func (entryL) LoadAuthor(ctx context.Context, e boil.ContextExecutor, singular bool, maybeEntry interface{}, mods queries.Applicator) error { var slice []*Entry var object *Entry if singular { object = maybeEntry.(*Entry) } else { slice = *maybeEntry.(*[]*Entry) } args := make([]interface{}, 0, 1) if singular { if object.R == nil { object.R = &entryR{} } args = append(args, object.AuthorID) } else { Outer: for _, obj := range slice { if obj.R == nil { obj.R = &entryR{} } for _, a := range args { if a == obj.AuthorID { continue Outer } } args = append(args, obj.AuthorID) } } if len(args) == 0 { return nil } query := NewQuery(qm.From(`users`), qm.WhereIn(`id in ?`, args...)) if mods != nil { mods.Apply(query) } results, err := query.QueryContext(ctx, e) if err != nil { return errors.Wrap(err, "failed to eager load User") } var resultSlice []*User if err = queries.Bind(results, &resultSlice); err != nil { return errors.Wrap(err, "failed to bind eager loaded slice User") } if err = results.Close(); err != nil { return errors.Wrap(err, "failed to close results of eager load for users") } if err = results.Err(); err != nil { return errors.Wrap(err, "error occurred during iteration of eager loaded relations for users") } if len(entryAfterSelectHooks) != 0 { for _, obj := range resultSlice { if err := obj.doAfterSelectHooks(ctx, e); err != nil { return err } } } if len(resultSlice) == 0 { return nil } if singular { foreign := resultSlice[0] object.R.Author = foreign if foreign.R == nil { foreign.R = &userR{} } foreign.R.AuthorEntries = append(foreign.R.AuthorEntries, object) return nil } for _, local := range slice { for _, foreign := range resultSlice { if local.AuthorID == foreign.ID { local.R.Author = foreign if foreign.R == nil { foreign.R = &userR{} } foreign.R.AuthorEntries = append(foreign.R.AuthorEntries, local) break } } } return nil } // LoadBlog allows an eager lookup of values, cached into the // loaded structs of the objects. This is for an N-1 relationship. func (entryL) LoadBlog(ctx context.Context, e boil.ContextExecutor, singular bool, maybeEntry interface{}, mods queries.Applicator) error { var slice []*Entry var object *Entry if singular { object = maybeEntry.(*Entry) } else { slice = *maybeEntry.(*[]*Entry) } args := make([]interface{}, 0, 1) if singular { if object.R == nil { object.R = &entryR{} } args = append(args, object.BlogID) } else { Outer: for _, obj := range slice { if obj.R == nil { obj.R = &entryR{} } for _, a := range args { if a == obj.BlogID { continue Outer } } args = append(args, obj.BlogID) } } if len(args) == 0 { return nil } query := NewQuery(qm.From(`blogs`), qm.WhereIn(`id in ?`, args...)) if mods != nil { mods.Apply(query) } results, err := query.QueryContext(ctx, e) if err != nil { return errors.Wrap(err, "failed to eager load Blog") } var resultSlice []*Blog if err = queries.Bind(results, &resultSlice); err != nil { return errors.Wrap(err, "failed to bind eager loaded slice Blog") } if err = results.Close(); err != nil { return errors.Wrap(err, "failed to close results of eager load for blogs") } if err = results.Err(); err != nil { return errors.Wrap(err, "error occurred during iteration of eager loaded relations for blogs") } if len(entryAfterSelectHooks) != 0 { for _, obj := range resultSlice { if err := obj.doAfterSelectHooks(ctx, e); err != nil { return err } } } if len(resultSlice) == 0 { return nil } if singular { foreign := resultSlice[0] object.R.Blog = foreign if foreign.R == nil { foreign.R = &blogR{} } foreign.R.Entries = append(foreign.R.Entries, object) return nil } for _, local := range slice { for _, foreign := range resultSlice { if local.BlogID == foreign.ID { local.R.Blog = foreign if foreign.R == nil { foreign.R = &blogR{} } foreign.R.Entries = append(foreign.R.Entries, local) break } } } return nil } // SetAuthor of the entry to the related item. // Sets o.R.Author to related. // Adds o to related.R.AuthorEntries. func (o *Entry) SetAuthor(ctx context.Context, exec boil.ContextExecutor, insert bool, related *User) error { var err error if insert { if err = related.Insert(ctx, exec, boil.Infer()); err != nil { return errors.Wrap(err, "failed to insert into foreign table") } } updateQuery := fmt.Sprintf( "UPDATE \"entries\" SET %s WHERE %s", strmangle.SetParamNames("\"", "\"", 1, []string{"author_id"}), strmangle.WhereClause("\"", "\"", 2, entryPrimaryKeyColumns), ) values := []interface{}{related.ID, o.ID} if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, updateQuery) fmt.Fprintln(boil.DebugWriter, values) } if _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil { return errors.Wrap(err, "failed to update local table") } o.AuthorID = related.ID if o.R == nil { o.R = &entryR{ Author: related, } } else { o.R.Author = related } if related.R == nil { related.R = &userR{ AuthorEntries: EntrySlice{o}, } } else { related.R.AuthorEntries = append(related.R.AuthorEntries, o) } return nil } // SetBlog of the entry to the related item. // Sets o.R.Blog to related. // Adds o to related.R.Entries. func (o *Entry) SetBlog(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Blog) error { var err error if insert { if err = related.Insert(ctx, exec, boil.Infer()); err != nil { return errors.Wrap(err, "failed to insert into foreign table") } } updateQuery := fmt.Sprintf( "UPDATE \"entries\" SET %s WHERE %s", strmangle.SetParamNames("\"", "\"", 1, []string{"blog_id"}), strmangle.WhereClause("\"", "\"", 2, entryPrimaryKeyColumns), ) values := []interface{}{related.ID, o.ID} if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, updateQuery) fmt.Fprintln(boil.DebugWriter, values) } if _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil { return errors.Wrap(err, "failed to update local table") } o.BlogID = related.ID if o.R == nil { o.R = &entryR{ Blog: related, } } else { o.R.Blog = related } if related.R == nil { related.R = &blogR{ Entries: EntrySlice{o}, } } else { related.R.Entries = append(related.R.Entries, o) } return nil } // Entries retrieves all the records using an executor. func Entries(mods ...qm.QueryMod) entryQuery { mods = append(mods, qm.From("\"entries\"")) return entryQuery{NewQuery(mods...)} } // FindEntry retrieves a single record by ID with an executor. // If selectCols is empty Find will return all columns. func FindEntry(ctx context.Context, exec boil.ContextExecutor, iD int64, selectCols ...string) (*Entry, error) { entryObj := &Entry{} sel := "*" if len(selectCols) > 0 { sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",") } query := fmt.Sprintf( "select %s from \"entries\" where \"id\"=$1", sel, ) q := queries.Raw(query, iD) err := q.Bind(ctx, exec, entryObj) if err != nil { if errors.Cause(err) == sql.ErrNoRows { return nil, sql.ErrNoRows } return nil, errors.Wrap(err, "record: unable to select from entries") } return entryObj, nil } // Insert a single record using an executor. // See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts. func (o *Entry) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error { if o == nil { return errors.New("record: no entries provided for insertion") } var err error if !boil.TimestampsAreSkipped(ctx) { currTime := time.Now().In(boil.GetLocation()) if o.CreatedAt.IsZero() { o.CreatedAt = currTime } if o.UpdatedAt.IsZero() { o.UpdatedAt = currTime } } if err := o.doBeforeInsertHooks(ctx, exec); err != nil { return err } nzDefaults := queries.NonZeroDefaultSet(entryColumnsWithDefault, o) key := makeCacheKey(columns, nzDefaults) entryInsertCacheMut.RLock() cache, cached := entryInsertCache[key] entryInsertCacheMut.RUnlock() if !cached { wl, returnColumns := columns.InsertColumnSet( entryColumns, entryColumnsWithDefault, entryColumnsWithoutDefault, nzDefaults, ) cache.valueMapping, err = queries.BindMapping(entryType, entryMapping, wl) if err != nil { return err } cache.retMapping, err = queries.BindMapping(entryType, entryMapping, returnColumns) if err != nil { return err } if len(wl) != 0 { cache.query = fmt.Sprintf("INSERT INTO \"entries\" (\"%s\") %%sVALUES (%s)%%s", strings.Join(wl, "\",\""), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1)) } else { cache.query = "INSERT INTO \"entries\" %sDEFAULT VALUES%s" } var queryOutput, queryReturning string if len(cache.retMapping) != 0 { queryReturning = fmt.Sprintf(" RETURNING \"%s\"", strings.Join(returnColumns, "\",\"")) } cache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning) } value := reflect.Indirect(reflect.ValueOf(o)) vals := queries.ValuesFromMapping(value, cache.valueMapping) if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, cache.query) fmt.Fprintln(boil.DebugWriter, vals) } if len(cache.retMapping) != 0 { err = exec.QueryRowContext(ctx, cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...) } else { _, err = exec.ExecContext(ctx, cache.query, vals...) } if err != nil { return errors.Wrap(err, "record: unable to insert into entries") } if !cached { entryInsertCacheMut.Lock() entryInsertCache[key] = cache entryInsertCacheMut.Unlock() } return o.doAfterInsertHooks(ctx, exec) } // Update uses an executor to update the Entry. // See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. // Update does not automatically update the record in case of default values. Use .Reload() to refresh the records. func (o *Entry) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) { if !boil.TimestampsAreSkipped(ctx) { currTime := time.Now().In(boil.GetLocation()) o.UpdatedAt = currTime } var err error if err = o.doBeforeUpdateHooks(ctx, exec); err != nil { return 0, err } key := makeCacheKey(columns, nil) entryUpdateCacheMut.RLock() cache, cached := entryUpdateCache[key] entryUpdateCacheMut.RUnlock() if !cached { wl := columns.UpdateColumnSet( entryColumns, entryPrimaryKeyColumns, ) if !columns.IsWhitelist() { wl = strmangle.SetComplement(wl, []string{"created_at"}) } if len(wl) == 0 { return 0, errors.New("record: unable to update entries, could not build whitelist") } cache.query = fmt.Sprintf("UPDATE \"entries\" SET %s WHERE %s", strmangle.SetParamNames("\"", "\"", 1, wl), strmangle.WhereClause("\"", "\"", len(wl)+1, entryPrimaryKeyColumns), ) cache.valueMapping, err = queries.BindMapping(entryType, entryMapping, append(wl, entryPrimaryKeyColumns...)) if err != nil { return 0, err } } values := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping) if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, cache.query) fmt.Fprintln(boil.DebugWriter, values) } var result sql.Result result, err = exec.ExecContext(ctx, cache.query, values...) if err != nil { return 0, errors.Wrap(err, "record: unable to update entries row") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "record: failed to get rows affected by update for entries") } if !cached { entryUpdateCacheMut.Lock() entryUpdateCache[key] = cache entryUpdateCacheMut.Unlock() } return rowsAff, o.doAfterUpdateHooks(ctx, exec) } // UpdateAll updates all rows with the specified column values. func (q entryQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) { queries.SetUpdate(q.Query, cols) result, err := q.Query.ExecContext(ctx, exec) if err != nil { return 0, errors.Wrap(err, "record: unable to update all for entries") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "record: unable to retrieve rows affected for entries") } return rowsAff, nil } // UpdateAll updates all rows with the specified column values, using an executor. func (o EntrySlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) { ln := int64(len(o)) if ln == 0 { return 0, nil } if len(cols) == 0 { return 0, errors.New("record: update all requires at least one column argument") } colNames := make([]string, len(cols)) args := make([]interface{}, len(cols)) i := 0 for name, value := range cols { colNames[i] = name args[i] = value i++ } // Append all of the primary key values for each column for _, obj := range o { pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), entryPrimaryKeyMapping) args = append(args, pkeyArgs...) } sql := fmt.Sprintf("UPDATE \"entries\" SET %s WHERE %s", strmangle.SetParamNames("\"", "\"", 1, colNames), strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, entryPrimaryKeyColumns, len(o))) if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, sql) fmt.Fprintln(boil.DebugWriter, args...) } result, err := exec.ExecContext(ctx, sql, args...) if err != nil { return 0, errors.Wrap(err, "record: unable to update all in entry slice") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "record: unable to retrieve rows affected all in update all entry") } return rowsAff, nil } // Upsert attempts an insert using an executor, and does an update or ignore on conflict. // See boil.Columns documentation for how to properly use updateColumns and insertColumns. func (o *Entry) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error { if o == nil { return errors.New("record: no entries provided for upsert") } if !boil.TimestampsAreSkipped(ctx) { currTime := time.Now().In(boil.GetLocation()) if o.CreatedAt.IsZero() { o.CreatedAt = currTime } o.UpdatedAt = currTime } if err := o.doBeforeUpsertHooks(ctx, exec); err != nil { return err } nzDefaults := queries.NonZeroDefaultSet(entryColumnsWithDefault, o) // Build cache key in-line uglily - mysql vs psql problems buf := strmangle.GetBuffer() if updateOnConflict { buf.WriteByte('t') } else { buf.WriteByte('f') } buf.WriteByte('.') for _, c := range conflictColumns { buf.WriteString(c) } buf.WriteByte('.') buf.WriteString(strconv.Itoa(updateColumns.Kind)) for _, c := range updateColumns.Cols { buf.WriteString(c) } buf.WriteByte('.') buf.WriteString(strconv.Itoa(insertColumns.Kind)) for _, c := range insertColumns.Cols { buf.WriteString(c) } buf.WriteByte('.') for _, c := range nzDefaults { buf.WriteString(c) } key := buf.String() strmangle.PutBuffer(buf) entryUpsertCacheMut.RLock() cache, cached := entryUpsertCache[key] entryUpsertCacheMut.RUnlock() var err error if !cached { insert, ret := insertColumns.InsertColumnSet( entryColumns, entryColumnsWithDefault, entryColumnsWithoutDefault, nzDefaults, ) update := updateColumns.UpdateColumnSet( entryColumns, entryPrimaryKeyColumns, ) if updateOnConflict && len(update) == 0 { return errors.New("record: unable to upsert entries, could not build update column list") } conflict := conflictColumns if len(conflict) == 0 { conflict = make([]string, len(entryPrimaryKeyColumns)) copy(conflict, entryPrimaryKeyColumns) } cache.query = buildUpsertQueryPostgres(dialect, "\"entries\"", updateOnConflict, ret, update, conflict, insert) cache.valueMapping, err = queries.BindMapping(entryType, entryMapping, insert) if err != nil { return err } if len(ret) != 0 { cache.retMapping, err = queries.BindMapping(entryType, entryMapping, ret) if err != nil { return err } } } value := reflect.Indirect(reflect.ValueOf(o)) vals := queries.ValuesFromMapping(value, cache.valueMapping) var returns []interface{} if len(cache.retMapping) != 0 { returns = queries.PtrsFromMapping(value, cache.retMapping) } if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, cache.query) fmt.Fprintln(boil.DebugWriter, vals) } if len(cache.retMapping) != 0 { err = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...) if err == sql.ErrNoRows { err = nil // Postgres doesn't return anything when there's no update } } else { _, err = exec.ExecContext(ctx, cache.query, vals...) } if err != nil { return errors.Wrap(err, "record: unable to upsert entries") } if !cached { entryUpsertCacheMut.Lock() entryUpsertCache[key] = cache entryUpsertCacheMut.Unlock() } return o.doAfterUpsertHooks(ctx, exec) } // Delete deletes a single Entry record with an executor. // Delete will match against the primary key column to find the record to delete. func (o *Entry) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) { if o == nil { return 0, errors.New("record: no Entry provided for delete") } if err := o.doBeforeDeleteHooks(ctx, exec); err != nil { return 0, err } args := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), entryPrimaryKeyMapping) sql := "DELETE FROM \"entries\" WHERE \"id\"=$1" if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, sql) fmt.Fprintln(boil.DebugWriter, args...) } result, err := exec.ExecContext(ctx, sql, args...) if err != nil { return 0, errors.Wrap(err, "record: unable to delete from entries") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "record: failed to get rows affected by delete for entries") } if err := o.doAfterDeleteHooks(ctx, exec); err != nil { return 0, err } return rowsAff, nil } // DeleteAll deletes all matching rows. func (q entryQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) { if q.Query == nil { return 0, errors.New("record: no entryQuery provided for delete all") } queries.SetDelete(q.Query) result, err := q.Query.ExecContext(ctx, exec) if err != nil { return 0, errors.Wrap(err, "record: unable to delete all from entries") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "record: failed to get rows affected by deleteall for entries") } return rowsAff, nil } // DeleteAll deletes all rows in the slice, using an executor. func (o EntrySlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) { if o == nil { return 0, errors.New("record: no Entry slice provided for delete all") } if len(o) == 0 { return 0, nil } if len(entryBeforeDeleteHooks) != 0 { for _, obj := range o { if err := obj.doBeforeDeleteHooks(ctx, exec); err != nil { return 0, err } } } var args []interface{} for _, obj := range o { pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), entryPrimaryKeyMapping) args = append(args, pkeyArgs...) } sql := "DELETE FROM \"entries\" WHERE " + strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, entryPrimaryKeyColumns, len(o)) if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, sql) fmt.Fprintln(boil.DebugWriter, args) } result, err := exec.ExecContext(ctx, sql, args...) if err != nil { return 0, errors.Wrap(err, "record: unable to delete all from entry slice") } rowsAff, err := result.RowsAffected() if err != nil { return 0, errors.Wrap(err, "record: failed to get rows affected by deleteall for entries") } if len(entryAfterDeleteHooks) != 0 { for _, obj := range o { if err := obj.doAfterDeleteHooks(ctx, exec); err != nil { return 0, err } } } return rowsAff, nil } // Reload refetches the object from the database // using the primary keys with an executor. func (o *Entry) Reload(ctx context.Context, exec boil.ContextExecutor) error { ret, err := FindEntry(ctx, exec, o.ID) if err != nil { return err } *o = *ret return nil } // ReloadAll refetches every row with matching primary key column values // and overwrites the original object slice with the newly updated slice. func (o *EntrySlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error { if o == nil || len(*o) == 0 { return nil } slice := EntrySlice{} var args []interface{} for _, obj := range *o { pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), entryPrimaryKeyMapping) args = append(args, pkeyArgs...) } sql := "SELECT \"entries\".* FROM \"entries\" WHERE " + strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, entryPrimaryKeyColumns, len(*o)) q := queries.Raw(sql, args...) err := q.Bind(ctx, exec, &slice) if err != nil { return errors.Wrap(err, "record: unable to reload all in EntrySlice") } *o = slice return nil } // EntryExists checks if the Entry row exists. func EntryExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error) { var exists bool sql := "select exists(select 1 from \"entries\" where \"id\"=$1 limit 1)" if boil.DebugMode { fmt.Fprintln(boil.DebugWriter, sql) fmt.Fprintln(boil.DebugWriter, iD) } row := exec.QueryRowContext(ctx, sql, iD) err := row.Scan(&exists) if err != nil { return false, errors.Wrap(err, "record: unable to check if entries exists") } return exists, nil }
sdmg15/GoodDAPP
src/lib/share/__tests__/generateReceiveShareObject.js
<reponame>sdmg15/GoodDAPP import { generateReceiveShareObject, generateShareLink } from '../' const isReceiveLink = generateShareLink('receive', { amount: '123' }) describe('generateReceiveShareObject', () => { it(`should return an object for receipt with code, amount, to and from`, () => { // Given const title = 'Sending G$ via GoodDollar App' const message = "<NAME>, You've got a request from <NAME> for 1 G$. To approve transfer open: " // When const shareObject = generateReceiveShareObject({ amount: '123' }, 100, '<NAME>', '<NAME>') // Then expect(shareObject.title).toBe(title) expect(shareObject.message).toBe(message) expect(shareObject.url).toMatch(isReceiveLink) }) it(`should return an object for receipt with code, to and from`, () => { // Given const title = 'Sending G$ via GoodDollar App' const message = "<NAME>, You've got a request from <NAME>. To approve transfer open: " // When const shareObject = generateReceiveShareObject({ amount: '123' }, 0, '<NAME>', '<NAME>') // Then expect(shareObject.title).toBe(title) expect(shareObject.message).toBe(message) expect(shareObject.url).toMatch(isReceiveLink) }) it(`should return an object for receipt with code, amount and from`, () => { // Given const title = 'Sending G$ via GoodDollar App' const message = "You've got a request from <NAME> for 1 G$. To approve transfer open: " // When const shareObject = generateReceiveShareObject({ amount: '123' }, '100', '', '<NAME>') // Then expect(shareObject.title).toBe(title) expect(shareObject.message).toBe(message) expect(shareObject.url).toMatch(isReceiveLink) }) it(`should return an object for receipt with code and from`, () => { // Given const title = 'Sending G$ via GoodDollar App' const message = "You've got a request from <NAME>. To approve transfer open: " // When const shareObject = generateReceiveShareObject({ amount: '123' }, 0, '', '<NAME>') // Then expect(shareObject.title).toBe(title) expect(shareObject.message).toBe(message) expect(shareObject.url).toMatch(isReceiveLink) }) })
fieldenms/
platform-pojo-bl/src/main/java/ua/com/fielden/platform/entity/annotation/CompanionObject.java
package ua.com.fielden.platform.entity.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import ua.com.fielden.platform.dao.IEntityDao; import ua.com.fielden.platform.entity.AbstractEntity; /** * Annotation for specify a default controller for an domain entity. * * @author <NAME> * */ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE }) public @interface CompanionObject { Class<? extends IEntityDao<? extends AbstractEntity<?>>> value(); }
Andreynnt/2018_1_Drive
public/js/services/user-service.js
import {httpModule} from '../modules/http'; export class UserService { checkAuth() { this.loadMe((err, me) => { if (err) { console.dir(me); console.log('Вы не авторизованы'); return; } console.log('me is', me); alert('Добро пожаловать!'); }); } loadMe(callback) { httpModule.doGet({ url: '/user', callback }); } loadUsers(firstManPos, amountOfPeople) { return httpModule.promiseGet(`/leaders/${firstManPos}/${amountOfPeople}`); } logout() { httpModule.doGet({ url: '/logout' }); } RegOrSignin(type, formData) { if (type === 'register') { httpModule.promisePost('/register', formData) .then(response => alert('Ваш login: ' + response.user.login + ' и почта: ' + response.user.mail)) .catch(err => console.log(err)); } else if (type === 'login') { return httpModule.promisePost('/signin', formData) .then(response => { alert('Привет ' + response.user.login + '!'); return response; }) .catch(() => alert('Пользователь не существует')); } } }
faisalsanto007/Codes
data final practice/selection sort.cpp
#include <stdio.h> int min(int a[],int k,int n) { int i=k,l,m; for(i=i+1 ;i<n;i++) { if(a[k]>a[i]) { k=i; } } return k; } int main() { int i,j,k,l,a[1000],n; printf("Enter number of element: "); scanf("%d",&n); printf("Enter element: "); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++) { l=min(a,i,n); k=a[i]; a[i]=a[l]; a[l]=k; } for(i=0;i<n;i++) printf("%d ",a[i]); printf("\n"); }
andytubeee/jamhacks.ca
2021/src/data/Navbar/Privacy.js
<filename>2021/src/data/Navbar/Privacy.js<gh_stars>0 const PrivacyNavData = [ { label: 'Definitions', id: 'definitions-section', enabled: true, }, { label: 'Data', id: 'data-section', enabled: true, }, { label: 'Privacy', id: 'privacy-section', enabled: true, }, { label: 'Other', id: 'other-section', enabled: true, }, { label: 'Contact', id: 'contact-section', enabled: true, }, ]; export default PrivacyNavData;
ceekay1991/AliPayForDebug
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/GO2OStackedGridHeaderProtocol-Protocol.h
<filename>AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/GO2OStackedGridHeaderProtocol-Protocol.h<gh_stars>1-10 // // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by <NAME>. // #import "NSObject-Protocol.h" @class GO2OCommonTabbar, GO2OStackedGridHeaderView; @protocol GO2OStackedGridHeaderProtocol <NSObject> @optional - (void)stackedGridHeader:(GO2OStackedGridHeaderView *)arg1 tabbar:(GO2OCommonTabbar *)arg2 didSelectItemAtIndex:(long long)arg3 originIndex:(long long)arg4; @end
wrldwzrd89/older-java-games
MasterMaze/src/com/puttysoftware/mastermaze/battle/BattleTarget.java
<filename>MasterMaze/src/com/puttysoftware/mastermaze/battle/BattleTarget.java /* MasterMaze: An RPG Copyright (C) 2011-2012 <NAME> Any questions should be directed to the author via email at: <EMAIL> */ package com.puttysoftware.mastermaze.battle; public enum BattleTarget { SELF, ONE_ALLY, ONE_ENEMY, ALL_ALLIES, ALL_ENEMIES; }
jayvdb/django-formidable
docs/tests/test_forms_field_validations.py
from copy import deepcopy from . import validator, _load_fixture def test_field_validations(): form = _load_fixture('0017_fields_validations.json') errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 0 # An empty list should still validate form['fields'][0]['validations'] = [] errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 0 # wrong type should trigger a type error form['fields'][0]['validations'] = "something" errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 1 error = errors[0] assert error.validator == 'type' assert error.message == "'something' is not of type 'array'" def _load_17_fields_validations(): form = _load_fixture('0017_fields_validations.json') items = deepcopy(form['fields'][0]['validations']) item = deepcopy(items[0]) return form, items, item def test_field_validations_no_message(): form, items, no_message = _load_17_fields_validations() # Removing the overwritten message shouldn't invalidate the field del no_message['message'] form['fields'][0]['validations'] = [no_message] errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 0 def test_field_validations_no_type(): form, items, no_type = _load_17_fields_validations() del no_type['type'] form['fields'][0]['validations'] = [no_type] errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 1 error = errors[0] assert error.validator == 'required' assert error.message == "'type' is a required property" def test_field_validations_no_value(): form, items, no_value = _load_17_fields_validations() del no_value['value'] form['fields'][0]['validations'] = [no_value] errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 1 error = errors[0] assert error.validator == 'required' assert error.message == "'value' is a required property" # TODO: field validation grids # I don't know if it's possible to validate the grid. # # For the record, here's the grid: # * text: MINLENGTH, MAXLENGTH, REGEXP # * paragraph: MINLENGTH, MAXLENGTH, REGEXP # * date: GT, GTE, LT, LTE, EQ, NEQ, IS_AGE_ABOVE (>=), IS_AGE_UNDER (<), # IS_DATE_IN_THE_PAST, IS_DATE_IN_THE_FUTURE # * number: GT, GTE, LT, LTE, EQ, NEQ availablele_validation_types = [ 'EQ', 'GT', 'GTE', 'IS_AGE_ABOVE', 'IS_AGE_UNDER', 'IS_DATE_IN_THE_FUTURE', 'IS_DATE_IN_THE_PAST', 'LT', 'LTE', 'MAXLENGTH', 'MINLENGTH', 'NEQ', 'REGEXP' ] def test_field_validations_type_ok(): form, items, values = _load_17_fields_validations() for validation_type in availablele_validation_types: values.update({"type": validation_type}) form['fields'][0]['validations'] = [values] errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 0 def test_field_validations_wrong_type(): form, items, values = _load_17_fields_validations() values.update({"type": 'UNKNOWN'}) form['fields'][0]['validations'] = [values] errors = sorted(validator.iter_errors(form), key=lambda e: e.path) assert len(errors) == 1 error = errors[0] assert error.message == f"'UNKNOWN' is not one of {availablele_validation_types}" # noqa
yogjiao/midou
routers/Show/Show.js
<gh_stars>0 import React from 'react' import PageSpin from 'PageSpin/PageSpin.js' import ScrollingSpin from 'ScrollingSpin/ScrollingSpin.js' import Confirm from 'Confirm/Confirm.js' import Prompt from 'Prompt/Prompt.js' import { FETCH_STATUS_NO_MORE_PRODUCT, FETCH_SUCCESS, BASE_STATIC_DIR, BASE_PAGE_DIR, FETCH_NICE_SHOW, DELETE_NICE_SHOW, PAGE_TO_PAGE_SIGNAL, FETCH_GOOD, PUT_TO_CART, CUSTMER_SERVICE_ID } from 'macros.js' import { getMiDouToken, getUserIdFromMidouToken } from 'commonApp.js' import {fetchable, fetchAuth, fetchOption} from 'fetch.js' import errors from 'errors.js' let update = require('react-addons-update') import {getParentByClass} from 'util.js' import ua from 'uaParser.js' import ImageLayout from 'ImageLayout.js' import Hammer from 'hammerjs' import ShareToSocialMedia from 'ShareToSocialMedia/ShareToSocialMedia.js' import Swiper from 'Swiper' import NiceShowlayout from 'NiceShowlayout/NiceShowlayout.js' import MoreMenu from 'MoreMenu.js' import { backToNativePage, sendSignalToOtherPagesByOc, calloutNewWebview, getUserInfoFromApp, receiveNotificationsFromApp } from 'webviewInterface.js' import VideoPlayer from 'VideoPlayer/VideoPlayer.js' let reactMixin = require('react-mixin') import * as detailMixins from 'mixins/underwearDetail.js' import UnderweardetailBuyStack from 'UnderweardetailBuyStack/UnderweardetailBuyStack.js' import UnderwearSelectPanel from 'UnderwearSelectPanel/UnderwearSelectPanel.js' import './Show.less' class Show extends React.Component { constructor(props, context) { super(props, context); this.state = { isHiddenPageSpin: false, isHiddenConfirm: true, isHiddenMoreMenu: true, showData: { user: {}, goods: [], img: [], video: {} }, //goodsSelectedId: null, goodsSelectedIndex: 0, promptMsg: '', // for recommend underpants, it's the same to underwareDetail buyActionModel: 0, isHiddenSelectPanel: true, size: 0, allBase: [], braSize: 0, // bra baseSize: 0, // bra category: 1, // 1:文胸,2:底裤,3:情趣 boxes: [], // tags count: 1, goods: {inventoryInfo:{allBase:[], allSize: [], inventory:{}}}, }; } fetchShowData = () => { let url = `${FETCH_NICE_SHOW}/${this.props.params.showId}` this.setState({isHiddenPageSpin: false}) fetchOption(url) .then((data) => { if (data.rea == FETCH_SUCCESS) { if (data.show.is_valid == 0) { data.show.img = [`${BASE_STATIC_DIR}/img/audit.png`] } this.setState({showData: data.show})// goodsSelectedId: data.show.goods[0].id this.fetchDetailData(data.show.goods[this.state.goodsSelectedIndex].id) } else { throw new Error(errors[data.rea]) } }) .catch((error) => { }) .then(()=>{ this.setState({ isHiddenPageSpin: true, //isHiddenScrollingSpin: true }) }) }; deleteNiceShow = () => { let url = `${DELETE_NICE_SHOW}/${this.props.params.showId}` this.setState({isHiddenPageSpin: false}) fetchAuth(url) .then((data) => { if (data.rea == FETCH_SUCCESS) { this.setState({promptMsg: '删除成功'}) setTimeout(() => { backToNativePage() }, 3000) let signal = { signal: PAGE_TO_PAGE_SIGNAL.UPDATE_SHOWS } sendSignalToOtherPagesByOc(signal) } else { throw new Error(errors[data.rea]) } }) .catch((error) => { this.setState({promptMsg: error.message}) }) .then(()=>{ this.setState({ isHiddenPageSpin: true }) this.refs['prompt'].show() }) }; thisHandler = (e) => { let target if (target = getParentByClass(e.target, 'icon-ellipsis')) { this.setState({isHiddenMoreMenu: false}) } else if (target = getParentByClass(e.target, 'icon-share')) { this.setState({isHiddenMoreMenu: true}) this.refs['share'].show() } else if (target = getParentByClass(e.target, 'icon-delete')) { this.setState({isHiddenMoreMenu: true, isHiddenConfirm: false}) } else if (target = getParentByClass(e.target, 'matching-card')) { let index = target.getAttribute('data-index') this.setState({goodsSelectedIndex: index}) this.fetchDetailData(this.state.showData.goods[this.state.goodsSelectedIndex].id) } }; postDataToCartHandler = () => { let data = this.getPostToCartData() let url = `${PUT_TO_CART}/${this.state.buyActionModel}` fetchAuth(url, {method: 'post', body: JSON.stringify(data)}) .then((data) => { if (data.rea == FETCH_SUCCESS) { if (this.state.buyActionModel == 1) { // this.props.history.push() // this.props.history.goForward() if (ua.isApp()) { calloutNewWebview({url:`${window.location.origin}${BASE_PAGE_DIR}/order-created/${data.cid}/${this.state.buyActionModel}`}) } else { window.location.href = `${window.location.origin}${BASE_PAGE_DIR}/order-created/${data.cid}/${this.state.buyActionModel}` } } else { this.setState({promptMsg: '商品已添加到购物车'}) } } else { this.setState({promptMsg: errors[data.rea]}) } }) .catch((e) => { this.setState({promptMsg: errors[e.rea]}) }) .then(() => { this.refs['prompt'].show(); }) }; buyHandler = (e) => { let target, nextState if (target = getParentByClass(e.target, 'con-server')) { getUserInfoFromApp() .then((data) => { calloutNewWebview({url:`${window.location.origin}${BASE_PAGE_DIR}/im/${CUSTMER_SERVICE_ID}?productId=${this.state.showData.goods[this.state.goodsSelectedIndex].id}`}) }) .catch((error) => { this.setState({promptMsg: errors[error.rea]}) this.refs['prompt'].show() }) } else if (target = getParentByClass(e.target, 'push-to-cart')) { nextState = update(this.state, { isHiddenSelectPanel: {$set: false}, buyActionModel: {$set: 0} }) } else if (target = getParentByClass(e.target, 'buy-now')) { nextState = update(this.state, { isHiddenSelectPanel: {$set: false}, buyActionModel: {$set: 1} }) } nextState && this.setState(nextState) }; moreMenuHandler = (e) => { let target if (target = getParentByClass(e.target, 'cancel-selection')) { this.setState({isHiddenMoreMenu: true}) } }; confirmHandler = (e) => { let target if (target = getParentByClass(e.target, 'btn-cancel')) { this.setState({isHiddenConfirm: true}) } else if (target = getParentByClass(e.target, 'btn-confirm')) { this.setState({isHiddenConfirm: true}) this.deleteNiceShow() } }; fetchDetailData = (productId) => { this.state.isFetching = true //this.setState({isHiddenPageSpin: false}) let url = `${FETCH_GOOD}/${productId}` fetchable(url) .then((data) => { if (data.rea == FETCH_STATUS_NO_MORE_PRODUCT) { this.state.isHaveGoods = false } data.goods.inventoryInfo = this.rebuildInventory(data.goods.inventory, data.goods.category) delete data.goods.inventory let schema = { category: {$set: data.goods.category}, goods: {$set: data.goods}, isFetching:{$set: false}, isHiddenPageSpin: {$set: true}, hasLoadedData: {$set: true} } if (data.goods.category == '1') { let keys = Object.keys(data.goods.inventoryInfo.allBase) schema.allBase = {$set: keys} schema.baseSize = {$set: keys[0]} schema.braSize = {$set: data.goods.inventoryInfo.allBase[keys[0]][0]} //nextState.boxes = this.rebuildBoxes(nextState.braSize, nextState.baseSize, nextState.goods.inventoryInfo.inventory) } else { let keys = Object.keys(data.goods.inventoryInfo.inventory) schema.allSize = {$set: keys} schema.size = {$set: keys[0]} } let nextState = update(this.state, schema) this.setState(nextState) //return [nextState.goods.id] }) .catch((error) => { this.setState({ isFetching: false, isHiddenPageSpin: true }) }) .then((ids) => { if (getMiDouToken()) { this.freshCollectionBtnState(ids) } }) }; componentDidMount = () => { this.fetchShowData() // this.bindGesture() // // document.addEventListener('scroll', this.handleScroll); // // var mySwiper = new Swiper('.matching-group', { slideClass: 'matching-card' }); receiveNotificationsFromApp((data, callback) => { if (data.type == '2') {// refresh nices this.refs['share'].show() } }) }; componentWillUnmount = () => { }; render() { let goodsInfo = {} try { goodsInfo = this.state.showData.goods[this.state.goodsSelectedIndex] || {} } catch (e) {} return ( <div className="show-container" onClick={this.thisHandler}> <i className="iconfont icon-jubao" /> <div className="adjust-container"> <NiceShowlayout goodsSelectedId={goodsInfo.id}> { this.state.showData.video ? <VideoPlayer {...this.state.showData.video} /> : <ImageLayout images={this.state.showData.img}/> } <div className="user-wrap"> <div className="avatar" style={{backgroundImage: `url(${this.state.showData.user.headimg})`}}></div> <div className="user-name single-ellipsis">{this.state.showData.user.name}</div> <i className="iconfont icon-ellipsis" /> </div> <div className="user-comment" dangerouslySetInnerHTML={{__html: this.state.showData.comment}}/> <div className="matching-group"> <div className="swiper-wrapper"> { this.state.showData.goods.map((item, index) => { return ( <div className={this.state.goodsSelectedIndex == index? 'matching-card on' : 'matching-card'} data-index={index} data-id={item.id} > <div className="card-bg" key={index} style={{backgroundImage: `url(${item.main_img})`}}></div> </div> ) }) } </div> </div> <div className="underwear-wrap"> <div className="underwear-bg" style={{backgroundImage: `url(${goodsInfo.main_img})`}} ></div> <div className="underwear-name">{goodsInfo.name}</div> <p className="underwear-price">&yen; {goodsInfo.price}</p> </div> </NiceShowlayout> <UnderweardetailBuyStack buyHandler={this.buyHandler} isCollected={this.state.goods.isCollected} id={this.state.goods.id} isHiddenCollection={true} /> </div> <PageSpin isHidden={this.state.isHiddenPageSpin}/> <Confirm isHidden={this.state.isHiddenConfirm} thisHandler={this.confirmHandler}/> { this.state.isHiddenMoreMenu ? '' : <MoreMenu thisHandler={this.moreMenuHandler} userId={this.state.showData.user.id}/> } <ShareToSocialMedia ref="share" url={window.location.href} title={(this.state.showData.goods[0] || {}).name} description={this.state.showData.comment} imgUrl={this.state.showData.share_img} /> <Prompt msg={this.state.promptMsg} ref='prompt'/> <UnderwearSelectPanel isHidden={this.state.isHiddenSelectPanel} allBase={this.state.allBase} {...this.state} selectHandler={this.selectHandler.bind(this)} /> </div> ) } } // Home.childContextTypes = { // pageSpin: React.PropTypes.node.isRequired // } // Home.contextTypes = { // name: React.PropTypes.string.isRequired, // //router: React.PropTypes.func.isRequired // } // Home.context = { // //pageSpin: pageSpin // } reactMixin(Show.prototype, detailMixins) module.exports = Show
farukranabappy89/google-ads-java
google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/enums/RecommendationTypeProto.java
<filename>google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/enums/RecommendationTypeProto.java // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v9/enums/recommendation_type.proto package com.google.ads.googleads.v9.enums; public final class RecommendationTypeProto { private RecommendationTypeProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v9_enums_RecommendationTypeEnum_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v9_enums_RecommendationTypeEnum_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n7google/ads/googleads/v9/enums/recommen" + "dation_type.proto\022\035google.ads.googleads." + "v9.enums\032\034google/api/annotations.proto\"\207" + "\004\n\026RecommendationTypeEnum\"\354\003\n\022Recommenda" + "tionType\022\017\n\013UNSPECIFIED\020\000\022\013\n\007UNKNOWN\020\001\022\023" + "\n\017CAMPAIGN_BUDGET\020\002\022\013\n\007KEYWORD\020\003\022\013\n\007TEXT" + "_AD\020\004\022\025\n\021TARGET_CPA_OPT_IN\020\005\022\037\n\033MAXIMIZE" + "_CONVERSIONS_OPT_IN\020\006\022\027\n\023ENHANCED_CPC_OP" + "T_IN\020\007\022\032\n\026SEARCH_PARTNERS_OPT_IN\020\010\022\032\n\026MA" + "XIMIZE_CLICKS_OPT_IN\020\t\022\030\n\024OPTIMIZE_AD_RO" + "TATION\020\n\022\025\n\021CALLOUT_EXTENSION\020\013\022\026\n\022SITEL" + "INK_EXTENSION\020\014\022\022\n\016CALL_EXTENSION\020\r\022\026\n\022K" + "EYWORD_MATCH_TYPE\020\016\022\026\n\022MOVE_UNUSED_BUDGE" + "T\020\017\022\037\n\033FORECASTING_CAMPAIGN_BUDGET\020\020\022\026\n\022" + "TARGET_ROAS_OPT_IN\020\021\022\030\n\024RESPONSIVE_SEARC" + "H_AD\020\022\022 \n\034MARGINAL_ROI_CAMPAIGN_BUDGET\020\023" + "B\354\001\n!com.google.ads.googleads.v9.enumsB\027" + "RecommendationTypeProtoP\001ZBgoogle.golang" + ".org/genproto/googleapis/ads/googleads/v" + "9/enums;enums\242\002\003GAA\252\002\035Google.Ads.GoogleA" + "ds.V9.Enums\312\002\035Google\\Ads\\GoogleAds\\V9\\En" + "ums\352\002!Google::Ads::GoogleAds::V9::Enumsb" + "\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_ads_googleads_v9_enums_RecommendationTypeEnum_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_ads_googleads_v9_enums_RecommendationTypeEnum_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v9_enums_RecommendationTypeEnum_descriptor, new java.lang.String[] { }); com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) }
satoshun/truth-android
truth-android/src/main/java/com/github/satoshun/truth/android/api/animation/AnimatorSetSubject.java
<filename>truth-android/src/main/java/com/github/satoshun/truth/android/api/animation/AnimatorSetSubject.java package com.github.satoshun.truth.android.api.animation; import android.animation.AnimatorSet; import android.annotation.TargetApi; import com.google.common.truth.FailureStrategy; import com.google.common.truth.SubjectFactory; import static android.os.Build.VERSION_CODES.HONEYCOMB; @TargetApi(HONEYCOMB) public class AnimatorSetSubject extends AnimatorSubject<AnimatorSetSubject, AnimatorSet> { public static final AnimatorSetSubjectFactory FACTORY = new AnimatorSetSubjectFactory(); public AnimatorSetSubject(FailureStrategy failureStrategy, AnimatorSet actual) { super(failureStrategy, actual); } public AnimatorSetSubject isAnimatorCount(int count) { isNotNull(); check().withFailureMessage("is animator count") .that(actual().getChildAnimations()) .hasSize(count); return myself(); } private static class AnimatorSetSubjectFactory extends SubjectFactory<AnimatorSetSubject, AnimatorSet> { @Override public AnimatorSetSubject getSubject(FailureStrategy fs, AnimatorSet that) { return new AnimatorSetSubject(fs, that); } } }
shashwatsingh/addons-server
src/olympia/translations/__init__.py
from django.conf import settings from django.utils.translation import trans_real from jinja2.filters import do_dictsort LOCALES = [(trans_real.to_locale(k).replace('_', '-'), v) for k, v in do_dictsort(settings.LANGUAGES)]
BennyJane/java-demo
java-base-demo/src/main/java/org/example/com/java8Demo/DateDemo.java
<filename>java-base-demo/src/main/java/org/example/com/java8Demo/DateDemo.java package org.example.com.java8Demo; import java.time.*; public class DateDemo { public static void main(String[] args) { methodTest(); } static void methodTest() { // Clock // 替代了 System.currentTimeMillis() TimeZone.getDefault() final Clock clock = Clock.systemUTC(); System.out.println(clock.instant()); // 当前时区的时间 System.out.println(clock.millis()); // 纳米时间 // LocalDate 获取时间的日期部分 final LocalDate date = LocalDate.now(); final LocalDate dateFromClock = LocalDate.now(clock); System.out.println(date); System.out.println(dateFromClock); final LocalTime time = LocalTime.now(); final LocalTime timeFromCock = LocalTime.now( clock); System.out.println(time); System.out.println(timeFromCock); // LocalDateTime 同时包含了LocalDate LocalTime的信息,但不包含ISO-8601日历系统中的时区信息 final LocalDateTime datetime = LocalDateTime.now(); final LocalDateTime datetimeFromClock = LocalDateTime.now(clock); System.out.println(datetime); System.out.println(datetimeFromClock); // ZoneDateTime: 保存有ISO-8601日期系统的日期和时间,而且有时区信息 // Get the zoned date/time final ZonedDateTime zonedDatetime = ZonedDateTime.now(); final ZonedDateTime zonedDatetimeFromClock = ZonedDateTime.now( clock ); final ZonedDateTime zonedDatetimeFromZone = ZonedDateTime.now( ZoneId.of( "America/Los_Angeles" ) ); System.out.println( zonedDatetime ); System.out.println( zonedDatetimeFromClock ); System.out.println( zonedDatetimeFromZone ); // Duration类,它持有的时间精确到秒和纳秒,可以很容易得计算两个日期之间的不同 // Get duration between two dates final LocalDateTime from = LocalDateTime.of( 2014, Month.APRIL, 16, 0, 0, 0 ); final LocalDateTime to = LocalDateTime.of( 2015, Month.APRIL, 16, 23, 59, 59 ); final Duration duration = Duration.between( from, to ); System.out.println( "Duration in days: " + duration.toDays() ); System.out.println( "Duration in hours: " + duration.toHours() ); } }
silvioedu/HackerRank-Python-Practice
basicDataTypes/FindTheRunnerUpScore.py
<reponame>silvioedu/HackerRank-Python-Practice if __name__ == '__main__': n = int(input()) arr = map(int, input().split()) lis = list(arr) z = max(lis) while max(lis) == z: lis.remove(max(lis)) print(max(lis))
gubaojian/weexuikit
RenderCore/render/platform/SharedBuffer.cpp
/* * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "render/platform/SharedBuffer.h" // #include "flutter/common/threads.h" #include "render/public/platform/Platform.h" #include "render/wtf/unicode/UTF8.h" #include "render/wtf/unicode/Unicode.h" #include "third_party/skia/include/private/SkMalloc.h" #undef SHARED_BUFFER_STATS #ifdef SHARED_BUFFER_STATS #include "render/wtf/DataLog.h" #endif namespace blink { static const unsigned segmentSize = 0x1000; static const unsigned segmentPositionMask = 0x0FFF; static inline unsigned segmentIndex(unsigned position) { return position / segmentSize; } static inline unsigned offsetInSegment(unsigned position) { return position & segmentPositionMask; } static inline char* allocateSegment() { return static_cast<char*>(fastMalloc(segmentSize)); } static inline void freeSegment(char* p) { fastFree(p); } #ifdef SHARED_BUFFER_STATS static Mutex& statsMutex() { DEFINE_STATIC_LOCAL(Mutex, mutex, ()); return mutex; } static HashSet<SharedBuffer*>& liveBuffers() { DEFINE_STATIC_LOCAL(HashSet<SharedBuffer*>, buffers, ()); return buffers; } static bool sizeComparator(SharedBuffer* a, SharedBuffer* b) { return a->size() > b->size(); } static CString snippetForBuffer(SharedBuffer* sharedBuffer) { const unsigned kMaxSnippetLength = 64; char* snippet = 0; unsigned snippetLength = std::min(sharedBuffer->size(), kMaxSnippetLength); CString result = CString::newUninitialized(snippetLength, snippet); const char* segment; unsigned offset = 0; while (unsigned segmentLength = sharedBuffer->getSomeData(segment, offset)) { unsigned length = std::min(segmentLength, snippetLength - offset); memcpy(snippet + offset, segment, length); offset += segmentLength; if (offset >= snippetLength) break; } for (unsigned i = 0; i < snippetLength; ++i) { if (!isASCIIPrintable(snippet[i])) snippet[i] = '?'; } return result; } static void printStats() { MutexLocker locker(statsMutex()); Vector<SharedBuffer*> buffers; for (HashSet<SharedBuffer*>::const_iterator iter = liveBuffers().begin(); iter != liveBuffers().end(); ++iter) buffers.append(*iter); std::sort(buffers.begin(), buffers.end(), sizeComparator); dataLogF("---- Shared Buffer Stats ----\n"); for (size_t i = 0; i < buffers.size() && i < 64; ++i) { CString snippet = snippetForBuffer(buffers[i]); dataLogF("Buffer size=%8u %s\n", buffers[i]->size(), snippet.data()); } } static void didCreateSharedBuffer(SharedBuffer* buffer) { MutexLocker locker(statsMutex()); liveBuffers().add(buffer); Threads::UI()->PostTask(printStats); } static void willDestroySharedBuffer(SharedBuffer* buffer) { MutexLocker locker(statsMutex()); liveBuffers().remove(buffer); } #endif SharedBuffer::SharedBuffer() : m_size(0), m_buffer(PurgeableVector::NotPurgeable) { #ifdef SHARED_BUFFER_STATS didCreateSharedBuffer(this); #endif } SharedBuffer::SharedBuffer(size_t size) : m_size(size), m_buffer(PurgeableVector::NotPurgeable) { m_buffer.reserveCapacity(size); m_buffer.grow(size); #ifdef SHARED_BUFFER_STATS didCreateSharedBuffer(this); #endif } SharedBuffer::SharedBuffer(const char* data, int size) : m_size(0), m_buffer(PurgeableVector::NotPurgeable) { // FIXME: Use unsigned consistently, and check for invalid casts when calling // into SharedBuffer from other code. if (size < 0) CRASH(); append(data, size); #ifdef SHARED_BUFFER_STATS didCreateSharedBuffer(this); #endif } SharedBuffer::SharedBuffer(const char* data, int size, PurgeableVector::PurgeableOption purgeable) : m_size(0), m_buffer(purgeable) { // FIXME: Use unsigned consistently, and check for invalid casts when calling // into SharedBuffer from other code. if (size < 0) CRASH(); append(data, size); #ifdef SHARED_BUFFER_STATS didCreateSharedBuffer(this); #endif } SharedBuffer::SharedBuffer(const unsigned char* data, int size) : m_size(0), m_buffer(PurgeableVector::NotPurgeable) { // FIXME: Use unsigned consistently, and check for invalid casts when calling // into SharedBuffer from other code. if (size < 0) CRASH(); append(reinterpret_cast<const char*>(data), size); #ifdef SHARED_BUFFER_STATS didCreateSharedBuffer(this); #endif } SharedBuffer::~SharedBuffer() { clear(); #ifdef SHARED_BUFFER_STATS willDestroySharedBuffer(this); #endif } PassRefPtr<SharedBuffer> SharedBuffer::adoptVector(Vector<char>& vector) { RefPtr<SharedBuffer> buffer = create(); buffer->m_buffer.adopt(vector); buffer->m_size = buffer->m_buffer.size(); return buffer.release(); } unsigned SharedBuffer::size() const { return m_size; } const char* SharedBuffer::data() const { mergeSegmentsIntoBuffer(); return m_buffer.data(); } void SharedBuffer::append(PassRefPtr<SharedBuffer> data) { const char* segment; size_t position = 0; while (size_t length = data->getSomeData(segment, position)) { append(segment, length); position += length; } } void SharedBuffer::append(const char* data, unsigned length) { ASSERT(isLocked()); if (!length) return; ASSERT(m_size >= m_buffer.size()); unsigned positionInSegment = offsetInSegment(m_size - m_buffer.size()); m_size += length; if (m_size <= segmentSize) { // No need to use segments for small resource data. m_buffer.append(data, length); return; } char* segment; if (!positionInSegment) { segment = allocateSegment(); m_segments.append(segment); } else segment = m_segments.last() + positionInSegment; unsigned segmentFreeSpace = segmentSize - positionInSegment; unsigned bytesToCopy = std::min(length, segmentFreeSpace); for (;;) { memcpy(segment, data, bytesToCopy); if (static_cast<unsigned>(length) == bytesToCopy) break; length -= bytesToCopy; data += bytesToCopy; segment = allocateSegment(); m_segments.append(segment); bytesToCopy = std::min(length, segmentSize); } } void SharedBuffer::append(const Vector<char>& data) { append(data.data(), data.size()); } void SharedBuffer::clear() { for (unsigned i = 0; i < m_segments.size(); ++i) freeSegment(m_segments[i]); m_segments.clear(); m_size = 0; m_buffer.clear(); } PassRefPtr<SharedBuffer> SharedBuffer::copy() const { RefPtr<SharedBuffer> clone(adoptRef(new SharedBuffer)); clone->m_size = m_size; clone->m_buffer.reserveCapacity(m_size); clone->m_buffer.append(m_buffer.data(), m_buffer.size()); if (!m_segments.isEmpty()) { const char* segment = 0; unsigned position = m_buffer.size(); while (unsigned segmentSize = getSomeData(segment, position)) { clone->m_buffer.append(segment, segmentSize); position += segmentSize; } ASSERT(position == clone->size()); } return clone.release(); } void SharedBuffer::mergeSegmentsIntoBuffer() const { unsigned bufferSize = m_buffer.size(); if (m_size > bufferSize) { m_buffer.reserveCapacity(m_size); unsigned bytesLeft = m_size - bufferSize; for (unsigned i = 0; i < m_segments.size(); ++i) { unsigned bytesToCopy = std::min(bytesLeft, segmentSize); m_buffer.append(m_segments[i], bytesToCopy); bytesLeft -= bytesToCopy; freeSegment(m_segments[i]); } m_segments.clear(); } } unsigned SharedBuffer::getSomeData(const char*& someData, unsigned position) const { ASSERT(isLocked()); unsigned totalSize = size(); if (position >= totalSize) { someData = 0; return 0; } ASSERT_WITH_SECURITY_IMPLICATION(position < m_size); unsigned consecutiveSize = m_buffer.size(); if (position < consecutiveSize) { someData = m_buffer.data() + position; return consecutiveSize - position; } position -= consecutiveSize; unsigned segments = m_segments.size(); unsigned maxSegmentedSize = segments * segmentSize; unsigned segment = segmentIndex(position); if (segment < segments) { unsigned bytesLeft = totalSize - consecutiveSize; unsigned segmentedSize = std::min(maxSegmentedSize, bytesLeft); unsigned positionInSegment = offsetInSegment(position); someData = m_segments[segment] + positionInSegment; return segment == segments - 1 ? segmentedSize - position : segmentSize - positionInSegment; } ASSERT_NOT_REACHED(); return 0; } sk_sp<SkData> SharedBuffer::getAsSkData() const { unsigned bufferLength = size(); char* buffer = static_cast<char*>(sk_malloc_throw(bufferLength)); const char* segment = 0; unsigned position = 0; while (unsigned segmentSize = getSomeData(segment, position)) { memcpy(buffer + position, segment, segmentSize); position += segmentSize; } if (position != bufferLength) { ASSERT_NOT_REACHED(); // Don't return the incomplete SkData. return nullptr; } return SkData::MakeFromMalloc(buffer, bufferLength); } bool SharedBuffer::lock() { return m_buffer.lock(); } void SharedBuffer::unlock() { mergeSegmentsIntoBuffer(); m_buffer.unlock(); } bool SharedBuffer::isLocked() const { return m_buffer.isLocked(); } } // namespace blink
PeterDinda/palacios
misc/network_servers/vtl/debug.cc
#include "debug.h" #include <time.h> #include <stdio.h> #include <stdarg.h> static FILE * logfile = NULL; static int debug_on = 0; int vtl_debug_init(string logfilename, int debug_enable) { debug_on = debug_enable; logfile = fopen(logfilename.c_str(), "w+"); return 0; } void vtl_debug(const char * fmt, ...) { if (debug_on) { va_list args; time_t dbgt; struct tm * time_data; char time_str[200]; time(&dbgt); time_data = localtime(&dbgt); strftime(time_str, sizeof(time_str), "%a %b %d %r %Y : ", time_data); fprintf(logfile, "%s", time_str); va_start(args, fmt); vfprintf(logfile, fmt, args); va_end(args); fflush(logfile); } }
popematt/ion-java
test/com/amazon/ion/impl/UnifiedInputStreamXTest.java
<reponame>popematt/ion-java /* * Copyright 2007-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazon.ion.impl; import org.junit.Assert; import org.junit.Test; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; public class UnifiedInputStreamXTest extends Assert { @Test public void testReadExactlyAvailable() throws Exception { class TestInputStream extends InputStream { int remaining = 10; @Override public int read() throws IOException { throw new UnsupportedOperationException(); } @Override public int read(byte[] b, int off, int len) throws IOException { if (remaining == 0) { throw new AssertionError("Unexpected call to read"); } int amount = len; if (amount > remaining) { amount = remaining; } for (int i = off; i < (off + amount); i++) { b[i] = (byte) 0xFF; } remaining -= amount; return amount; } } TestInputStream is = new TestInputStream(); UnifiedInputStreamX uix = UnifiedInputStreamX.makeStream(is); byte[] expected = new byte[10]; Arrays.fill(expected, (byte) 0xFF); byte[] actual = new byte[10]; int read = uix.read(actual, 0, actual.length); assertArrayEquals(expected, actual); } }
tangya3158613488/Java
exercise20_1_4/Example6.java
package exercise20_1_4; public class Example6 { public static void main(String args[]){ int elements[]={1,2,3,4}; int hold[]={10,9,8,7,6,5,4,3,2,1}; System.arraycopy(elements, 0, hold, 0, elements.length); System.out.println("长度为:"+hold.length); for(int i=0; i < hold.length; i++) System.out.print(" "+hold[i]); } }
restapicoding/VMware-SDK
samples/vsphere/common/vapiconnect.py
""" * ******************************************************* * Copyright (c) VMware, Inc. 2016. All Rights Reserved. * SPDX-License-Identifier: MIT * ******************************************************* * * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN, * EXPRESS OR IMPLIED. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED * WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, * NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. """ __author__ = 'VMware, Inc.' __copyright__ = 'Copyright 2016 VMware, Inc. All rights reserved.' import requests from com.vmware.cis_client import Session from vmware.vapi.lib.connect import get_requests_connector from vmware.vapi.security.session import create_session_security_context from vmware.vapi.security.user_password import \ create_user_password_security_context from vmware.vapi.stdlib.client.factories import StubConfigurationFactory def get_jsonrpc_endpoint_url(host): # The URL for the stub requests are made against the /api HTTP endpoint # of the vCenter system. return "https://{}/api".format(host) def connect(host, user, pwd, skip_verification=False, cert_path=None, suppress_warning=True): """ Create an authenticated stub configuration object that can be used to issue requests against vCenter. Returns a stub_config that stores the session identifier that can be used to issue authenticated requests against vCenter. """ host_url = get_jsonrpc_endpoint_url(host) session = requests.Session() if skip_verification: session = create_unverified_session(session, suppress_warning) elif cert_path: session.verify = cert_path connector = get_requests_connector(session=session, url=host_url) stub_config = StubConfigurationFactory.new_std_configuration(connector) return login(stub_config, user, pwd) def login(stub_config, user, pwd): """ Create an authenticated session with vCenter. Returns a stub_config that stores the session identifier that can be used to issue authenticated requests against vCenter. """ # Pass user credentials (user/password) in the security context to # authenticate. user_password_security_context = create_user_password_security_context(user, pwd) stub_config.connector.set_security_context(user_password_security_context) # Create the stub for the session service and login by creating a session. session_svc = Session(stub_config) session_id = session_svc.create() # Successful authentication. Store the session identifier in the security # context of the stub and use that for all subsequent remote requests session_security_context = create_session_security_context(session_id) stub_config.connector.set_security_context(session_security_context) return stub_config def logout(stub_config): """ Delete session with vCenter. """ if stub_config: session_svc = Session(stub_config) session_svc.delete() def create_unverified_session(session, suppress_warning=True): """ Create a unverified session to disable the server certificate verification. This is not recommended in production code. """ session.verify = False if suppress_warning: # Suppress unverified https request warnings from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) return session
pauxy-qmc/pauxy
pauxy/thermal_propagation/continuous.py
import cmath import math import numpy import scipy.sparse.linalg import sys import time from pauxy.estimators.thermal import one_rdm_from_G, inverse_greens_function_qr from pauxy.propagation.operations import kinetic_real from pauxy.thermal_propagation.planewave import PlaneWave from pauxy.thermal_propagation.generic import GenericContinuous from pauxy.thermal_propagation.hubbard import HubbardContinuous from pauxy.utils.linalg import exponentiate_matrix class Continuous(object): """Propagator for generic many-electron Hamiltonian. Uses continuous HS transformation for exponential of two body operator. Parameters ---------- options : dict Propagator input options. qmc : :class:`pauxy.qmc.options.QMCOpts` QMC options. system : :class:`pauxy.system.System` System object. trial : :class:`pauxy.trial_wavefunctioin.Trial` Trial wavefunction object. verbose : bool If true print out more information during setup. """ def __init__(self, options, qmc, system, trial, verbose=False, lowrank=False): if verbose: print("# Parsing continuous propagator input options.") print("# Using continuous Hubbar--Stratonovich transformations.") # Input options self.hs_type = 'continuous' self.exp_nmax = options.get('expansion_order', 6) optimised = options.get('optimised', True) # Derived Attributes self.dt = qmc.dt self.sqrt_dt = qmc.dt**0.5 self.isqrt_dt = 1j*self.sqrt_dt self.nfb_trig = 0 self.lowrank = lowrank self.propagator = get_continuous_propagator(system, trial, qmc, options=options, verbose=verbose) # Mean field shifted one-body propagator self.mu = system.mu self.propagator.construct_one_body_propagator(system, qmc.dt) self.BH1 = self.propagator.BH1 self.BT = trial.dmat self.BTinv = trial.dmat_inv self.BT_BP = None self.mf_const_fac = cmath.exp(-self.dt*self.propagator.mf_core) self.nstblz = qmc.nstblz self.ebound = (2.0/self.dt)**0.5 self.mean_local_energy = 0 self.free_projection = options.get('free_projection', False) self.force_bias = options.get('force_bias', True) if self.free_projection: if verbose: print("# Using free projection.") print("# Setting force_bias to False with free projection.") self.force_bias = options.get('force_bias', False) self.propagate_walker = self.propagate_walker_free else: if verbose: print("# Using phaseless approximation.") if self.force_bias: print("# Setting force bias to %r."%self.force_bias) self.propagate_walker = self.propagate_walker_phaseless if verbose: print ("# Finished setting up propagator.") def two_body_propagator(self, walker, system, trial): r"""Continuous Hubbard-Statonovich transformation. Parameters ---------- walker : :class:`pauxy.walker.Walker` walker object to be updated. On output we have acted on phi by B_V(x). system : :class:`pauxy.system.System` System object. trial : :class:`pauxy.trial_wavefunctioin.Trial` Trial wavefunction object. """ # Normally distrubted auxiliary fields. xi = numpy.random.normal(0.0, 1.0, system.nfields) if self.force_bias: P = one_rdm_from_G(walker.G) xbar = self.propagator.construct_force_bias(system, P, trial) else: xbar = numpy.zeros(xi.shape, dtype=numpy.complex128) for i in range(system.nfields): if numpy.absolute(xbar[i]) > 1.0: # if self.nfb_trig < 10: # print("# Rescaling force bias is triggered") # print("# Warning will only be printed 10 times on root.") self.nfb_trig += 1 xbar[i] /= numpy.absolute(xbar[i]) # Constant factor arising from shifting the propability distribution. cfb = xi.dot(xbar) - 0.5*xbar.dot(xbar) xshifted = xi - xbar # Constant factor arising from force bias and mean field shift cmf = -self.sqrt_dt * xshifted.dot(self.propagator.mf_shift) # Operator terms contributing to propagator. VHS = self.propagator.construct_VHS(system, xshifted) return (cmf, cfb, xshifted, VHS) def estimate_eshift(self, walker): return 0.0 def exponentiate(self, VHS, debug=False): """Apply exponential propagator of the HS transformation Parameters ---------- system : system class phi : numpy array a state VHS : numpy array HS transformation potential Returns ------- phi : numpy array Exp(VHS) * phi """ # JOONHO: exact exponential # copy = numpy.copy(phi) # phi = scipy.linalg.expm(VHS).dot(copy) phi = numpy.identity(VHS.shape[0], dtype = numpy.complex128) if debug: copy = numpy.copy(phi) c2 = scipy.linalg.expm(VHS).dot(copy) Temp = numpy.identity(VHS.shape[0], dtype = numpy.complex128) for n in range(1, self.exp_nmax+1): Temp = VHS.dot(Temp) / n phi += Temp if debug: print("DIFF: {: 10.8e}".format((c2 - phi).sum() / c2.size)) return phi def propagate_walker_free(self, system, walker, trial, eshift=0): r"""Free projection for continuous HS transformation. .. Warning:: Currently not implemented. Parameters ---------- walker : :class:`walker.Walker` Walker object to be updated. on output we have acted on :math:`|\phi_i\rangle` by :math:`B` and updated the weight appropriately. Updates inplace. state : :class:`state.State` Simulation state. """ (cmf, cfb, xmxbar, VHS) = self.two_body_propagator(walker, system, trial) BV = self.exponentiate(VHS) B = numpy.array([BV.dot(self.BH1[0]),BV.dot(self.BH1[1])]) B = numpy.array([self.BH1[0].dot(B[0]),self.BH1[1].dot(B[1])]) # Compute determinant ratio det(1+A')/det(1+A). # 1. Current walker's green's function. G = walker.greens_function(trial, inplace=False) # 2. Compute updated green's function. walker.stack.update_new(B) walker.greens_function(trial, inplace=True) # 3. Compute det(G/G') M0 = [scipy.linalg.det(G[0], check_finite=False), scipy.linalg.det(G[1], check_finite=False)] Mnew = [scipy.linalg.det(walker.G[0], check_finite=False), scipy.linalg.det(walker.G[1], check_finite=False)] # Could save M0 rather than recompute. try: # Could save M0 rather than recompute. oratio = (M0[0] * M0[1]) / (Mnew[0] * Mnew[1]) walker.ot = 1.0 # Constant terms are included in the walker's weight. (magn, phase) = cmath.polar(cmath.exp(cmf+cfb)*oratio) walker.weight *= magn walker.phase *= cmath.exp(1j*phase) except ZeroDivisionError: walker.weight = 0.0 def propagate_walker_phaseless(self, system, walker, trial, eshift=0): r"""Propagate walker using phaseless approximation. Uses importance sampling and the hybrid method. Parameters ---------- walker : :class:`walker.Walker` Walker object to be updated. On output we have acted on phi with the propagator B(x), and updated the weight appropriately. Updates inplace. system : :class:`pauxy.system.System` System object. trial : :class:`pauxy.trial_wavefunctioin.Trial` Trial wavefunction object. """ (cmf, cfb, xmxbar, VHS) = self.two_body_propagator(walker, system, trial) BV = self.exponentiate(VHS) B = numpy.array([BV.dot(self.BH1[0]),BV.dot(self.BH1[1])]) B = numpy.array([self.BH1[0].dot(B[0]),self.BH1[1].dot(B[1])]) # Compute determinant ratio det(1+A')/det(1+A). # 1. Current walker's green's function. tix = walker.stack.ntime_slices # 2. Compute updated green's function. walker.stack.update_new(B) walker.greens_function(None, slice_ix=tix, inplace=True) # 3. Compute det(G/G') M0 = walker.M0 Mnew = [scipy.linalg.det(walker.G[0], check_finite=False), scipy.linalg.det(walker.G[1], check_finite=False)] try: # Could save M0 rather than recompute. oratio = (M0[0] * M0[1]) / (Mnew[0] * Mnew[1]) # Might want to cap this at some point hybrid_energy = cmath.log(oratio) + cfb + cmf Q = cmath.exp(hybrid_energy) expQ = self.mf_const_fac * Q (magn, phase) = cmath.polar(expQ) if not math.isinf(magn): # Determine cosine phase from Arg(det(1+A'(x))/det(1+A(x))). # Note this doesn't include exponential factor from shifting # propability distribution. dtheta = cmath.phase(cmath.exp(hybrid_energy-cfb)) cosine_fac = max(0, math.cos(dtheta)) walker.weight *= magn * cosine_fac walker.M0 = Mnew else: walker.weight = 0.0 except ZeroDivisionError: walker.weight = 0.0 def get_continuous_propagator(system, trial, qmc, options={}, verbose=False): """Wrapper to select propagator class. Parameters ---------- options : dict Propagator input options. qmc : :class:`pauxy.qmc.QMCOpts` class Trial wavefunction input options. system : class System class. trial : class Trial wavefunction object. Returns ------- propagator : class or None Propagator object. """ if system.name == "UEG": propagator = PlaneWave(system, trial, qmc, options=options, verbose=verbose) elif system.name == "Hubbard": propagator = HubbardContinuous(system, trial, qmc, options=options, verbose=verbose) elif system.name == "Generic": propagator = GenericContinuous(system, trial, qmc, options=options, verbose=verbose) else: propagator = None return propagator
nowkoai/test
ee/spec/features/groups/analytics/ci_cd_analytics_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Group CI/CD Analytics', :js do let_it_be(:user) { create(:user) } let_it_be_with_refind(:group) { create(:group) } let_it_be(:subgroup) { create(:group, parent: group ) } let_it_be(:project_1) { create(:project, group: group) } let_it_be(:project_2) { create(:project, group: group) } let_it_be(:project_3) { create(:project, group: subgroup) } let_it_be(:unrelated_project) { create(:project) } let_it_be(:releases) { create_list(:release, 10, project: project_1) } let_it_be(:releases) { create_list(:release, 5, project: project_3) } let_it_be(:unrelated_release) { create(:release, project: unrelated_project) } before do stub_licensed_features(group_ci_cd_analytics: true, dora4_analytics: true) group.add_reporter(user) sign_in(user) visit group_analytics_ci_cd_analytics_path(group) wait_for_requests end it 'renders statistics about release within the group', :aggregate_failures do within '[data-testid="release-stats-card"]' do expect(page).to have_content 'Releases All time' expect(page).to have_content '15 Releases 67% Projects with releases' end end shared_examples 'a DORA chart' do |selector, title| it "render the #{title} charts", :aggregate_failures do click_link(title) within selector do expect(page).to have_content title expect(page).to have_content 'Last week Last month Last 90 days' expect(page).to have_content 'Date range:' end end end describe 'DORA charts' do it_behaves_like 'a DORA chart', '[data-testid="deployment-frequency-charts"]', 'Deployment frequency' it_behaves_like 'a DORA chart', '[data-testid="lead-time-charts"]', 'Lead time' end end
Dazzed/dental-front
app/containers/AdminManagePage/actions.js
<gh_stars>0 import { CHANGE_PAGE_TITLE, FETCH_ACCOUNT_MANAGERS, SELECT_MANAGER, TOGGLE_ADDING_MANAGER, ADD_MANAGER, TOGGLE_EDITING_MANAGER, EDIT_MANAGER, FETCH_SERVICES_REQUEST, ADD_SERVICE_REQUEST, DELETE_SERVICE_REQUEST, TOGGLE_ADD_SERVICE, } from './constants'; export function changePageTitle (payload) { return { type: CHANGE_PAGE_TITLE, payload, }; } export function fetchAccountManagers() { return { type: FETCH_ACCOUNT_MANAGERS }; } export function selectManager(manager) { return { type: SELECT_MANAGER, payload: manager, }; } export function toggleAddingManager(value) { return { type: TOGGLE_ADDING_MANAGER, payload: value, } } export function addManager(values) { return { type: ADD_MANAGER, payload: values, } } export function toggleEditingManager(manager) { return { type: TOGGLE_EDITING_MANAGER, payload: manager }; } export function editManager(values) { return { type: EDIT_MANAGER, payload: values }; } export function fetchServices() { return { type: FETCH_SERVICES_REQUEST, } } export function addService(service) { return { type: ADD_SERVICE_REQUEST, payload: service, }; } export function deleteService(service) { return { type: DELETE_SERVICE_REQUEST, payload: service, }; } export function toggleAddService(value) { return { type: TOGGLE_ADD_SERVICE, payload: value, } }
photo/mobile-android
app/src/com/trovebox/android/app/ImageFragment.java
<filename>app/src/com/trovebox/android/app/ImageFragment.java package com.trovebox.android.app; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import com.trovebox.android.common.fragment.common.CommonFragment; import com.trovebox.android.common.util.CommonUtils; public final class ImageFragment extends CommonFragment { int imageResourceId; int contentResourceId; private static final String KEY_CONTENT = "ImageFragment:imageResourceId"; int mNum; public static Fragment newInstance(int i, int content) { ImageFragment f = new ImageFragment(); f.imageResourceId = i; f.contentResourceId = content; return f; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) { imageResourceId = savedInstanceState.getInt(KEY_CONTENT); } } @Override public View onCreateView(org.holoeverywhere.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { TextView text = new TextView(getActivity()); text.setGravity(Gravity.CENTER); text.setText(getString(contentResourceId)); text.setTextSize(10 * getResources().getDisplayMetrics().density); int padding = (int) getResources().getDimensionPixelSize(R.dimen.activity_intro_margin); text.setPadding(padding, padding, padding, padding); ImageView image = new ImageView(getActivity()); image.setImageResource(imageResourceId); LinearLayout layout = new LinearLayout(getActivity()); layout.setOrientation(LinearLayout.VERTICAL); if (CommonUtils.isFroyoOrHigher()) { layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } else { layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } layout.setGravity(Gravity.CENTER); layout.addView(image); layout.addView(text); return layout; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_CONTENT, imageResourceId); } }
GnaneshKunal/unix-programming
14_7.c
<filename>14_7.c #include <stdio.h> #include <unistd.h> #include <signal.h> #include <fcntl.h> #include <stdlib.h> int lock_reg(int fd, int cmd, int type, off_t offset, int whence, off_t len); #define FILE_MODE (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #define writew_lock(fd, offset, whence, len) lock_reg(fd, F_SETLK, F_WRLCK, offset, whence, len) static sigset_t oldmask, newmask, zeromask; static volatile sig_atomic_t sigflag; static void sig_fn(int signo) { sigflag = 1; } int lock_reg(int fd, int cmd, int type, off_t offset, int whence, off_t len) { struct flock lock; lock.l_type = type; //F_RWLOCK, F_WRLOCK, F_UNLCK lock.l_whence = whence; //byte offset, relative to l_whence lock.l_start = offset; //SEEK_SET, SEEK_CUR, SEEK_END lock.l_len = len; //bytes(0 means to EOF) return (fcntl(fd, cmd, &lock)); } void TELL_WAIT(void) { if(signal(SIGUSR1, sig_fn) == SIG_ERR) { puts("signal SIGUSR1 error"); exit(1); } if (signal(SIGUSR2, sig_fn) == SIG_ERR) { puts("signal SIGUSR2 error"); exit(1); } sigemptyset(&zeromask); sigemptyset(&newmask); sigaddset(&newmask, SIGUSR1); sigaddset(&newmask, SIGUSR2); if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) { puts("SIG_BLOCK error"); exit(1); } } void WAIT_PARENT(void) { while (sigflag == 0) sigsuspend(&zeromask); sigflag = 0; if (sigprocmask(SIG_SETMASK, &oldmask, 0) < 0) { puts("sigprocmask error"); exit(1); } } void WAIT_CHILD(void) { while (sigflag == 0) sigsuspend(&zeromask); sigflag = 0; if(sigprocmask(SIG_SETMASK, &oldmask, 0) < 0) { puts("sigprocmask error"); exit(1); } } void TELL_PARENT(pid_t pid) { kill(pid, SIGUSR2); } void TELL_CHILD(pid_t pid) { kill(pid, SIGUSR1); } static void lockabyte(const char *name, int fd, off_t offset) { if (writew_lock(fd, offset, SEEK_SET, 1) < 0) { puts("write_lock error"); exit(1); } printf("%s: got the lock, byte %lld\n", name, (long long)offset); } int main(void) { int fd; pid_t pid; //create a file and write two bytes to it if ((fd = creat("templock", FILE_MODE)) < 0) { puts("creat error"); exit(1); } if (write(fd, "ab", 2) != 2) { puts("write error"); exit(1); } TELL_WAIT(); if ((pid = fork()) < 0) { puts("fork error"); exit(1); } else if (pid == 0) { lockabyte("child", fd, 0); TELL_PARENT(getppid()); WAIT_PARENT(); lockabyte("child", fd, 1); } else { lockabyte("parent", fd, 1); TELL_CHILD(pid); WAIT_CHILD(); lockabyte("parent", fd, 0); } exit(0); }
karthikswarna/cpg
src/main/java/de/fraunhofer/aisec/cpg/graph/statements/BreakStatement.java
<gh_stars>1-10 /* * Copyright (c) 2020, Fraunhofer AISEC. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * $$$$$$\ $$$$$$$\ $$$$$$\ * $$ __$$\ $$ __$$\ $$ __$$\ * $$ / \__|$$ | $$ |$$ / \__| * $$ | $$$$$$$ |$$ |$$$$\ * $$ | $$ ____/ $$ |\_$$ | * $$ | $$\ $$ | $$ | $$ | * \$$$$$ |$$ | \$$$$$ | * \______/ \__| \______/ * */ package de.fraunhofer.aisec.cpg.graph.statements; import java.util.Objects; /** * Statement used to interrupt further execution of a loop body and exit the respective loop * context. Can have a loop label, e.g. in Java, to specify which of the nested loops should be * broken out of. */ public class BreakStatement extends Statement { private String label = null; /** * Specifies the label of the loop in a nested structure that this statement will 'break' * * @return the label */ public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof BreakStatement)) { return false; } BreakStatement that = (BreakStatement) o; return super.equals(that) && Objects.equals(label, that.label); } @Override public int hashCode() { return super.hashCode(); } }
hangar18rip/backtotechtesting
go/internal/services/loadbalancer/backend_address_pool_address_resource_test.go
package loadbalancer_test import ( "context" "fmt" "testing" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/types" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) var _ types.TestResourceVerifyingRemoved = BackendAddressPoolAddressResourceTests{} type BackendAddressPoolAddressResourceTests struct{} func TestAccBackendAddressPoolAddressBasic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_lb_backend_address_pool_address", "test") r := BackendAddressPoolAddressResourceTests{} data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), }) } func TestAccBackendAddressPoolAddressRequiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_lb_backend_address_pool_address", "test") r := BackendAddressPoolAddressResourceTests{} data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.RequiresImportErrorStep(r.requiresImport), }) } func TestAccBackendAddressPoolAddressDisappears(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_lb_backend_address_pool_address", "test") r := BackendAddressPoolAddressResourceTests{} data.ResourceTest(t, r, []acceptance.TestStep{ data.DisappearsStep(acceptance.DisappearsStepData{ Config: r.basic, TestResource: r, }), }) } func TestAccBackendAddressPoolAddressUpdate(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_lb_backend_address_pool_address", "test") r := BackendAddressPoolAddressResourceTests{} data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), }) } func (BackendAddressPoolAddressResourceTests) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.BackendAddressPoolAddressID(state.ID) if err != nil { return nil, err } pool, err := client.LoadBalancers.LoadBalancerBackendAddressPoolsClient.Get(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName) if err != nil { return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } if pool.BackendAddressPoolPropertiesFormat == nil { return nil, fmt.Errorf("retrieving %s: `properties` was nil", *id) } if pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses != nil { for _, address := range *pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses { if address.Name == nil { continue } if *address.Name == id.AddressName { return utils.Bool(true), nil } } } return utils.Bool(false), nil } func (BackendAddressPoolAddressResourceTests) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.BackendAddressPoolAddressID(state.ID) if err != nil { return nil, err } pool, err := client.LoadBalancers.LoadBalancerBackendAddressPoolsClient.Get(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName) if err != nil { return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } if pool.BackendAddressPoolPropertiesFormat == nil { return nil, fmt.Errorf("retrieving %s: `properties` was nil", *id) } addresses := make([]network.LoadBalancerBackendAddress, 0) if pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses != nil { addresses = *pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses } newAddresses := make([]network.LoadBalancerBackendAddress, 0) for _, address := range addresses { if address.Name == nil { continue } if *address.Name != id.AddressName { newAddresses = append(newAddresses, address) } } pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses = &newAddresses future, err := client.LoadBalancers.LoadBalancerBackendAddressPoolsClient.CreateOrUpdate(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName, pool) if err != nil { return nil, fmt.Errorf("updating %s: %+v", *id, err) } if err := future.WaitForCompletionRef(ctx, client.LoadBalancers.LoadBalancerBackendAddressPoolsClient.Client); err != nil { return nil, fmt.Errorf("waiting for update of %s: %+v", *id, err) } return utils.Bool(true), nil } // nolint unused - for future use func (BackendAddressPoolAddressResourceTests) backendAddressPoolHasAddresses(expected int) acceptance.ClientCheckFunc { return func(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) error { id, err := parse.LoadBalancerBackendAddressPoolID(state.ID) if err != nil { return err } client := clients.LoadBalancers.LoadBalancerBackendAddressPoolsClient pool, err := client.Get(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName) if err != nil { return err } if pool.BackendAddressPoolPropertiesFormat == nil { return fmt.Errorf("`properties` is nil") } if pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses == nil { return fmt.Errorf("`properties.loadBalancerBackendAddresses` is nil") } actual := len(*pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses) if actual != expected { return fmt.Errorf("expected %d but got %d addresses", expected, actual) } return nil } } func (t BackendAddressPoolAddressResourceTests) basic(data acceptance.TestData) string { template := t.template(data) return fmt.Sprintf(` provider "azurerm" { features {} } %s resource "azurerm_lb_backend_address_pool_address" "test" { name = "address" backend_address_pool_id = azurerm_lb_backend_address_pool.test.id virtual_network_id = azurerm_virtual_network.test.id ip_address = "172.16.31.10" } `, template) } func (t BackendAddressPoolAddressResourceTests) requiresImport(data acceptance.TestData) string { template := t.basic(data) return fmt.Sprintf(` %s resource "azurerm_lb_backend_address_pool_address" "import" { name = azurerm_lb_backend_address_pool_address.test.name backend_address_pool_id = azurerm_lb_backend_address_pool_address.test.backend_address_pool_id virtual_network_id = azurerm_lb_backend_address_pool_address.test.virtual_network_id ip_address = azurerm_lb_backend_address_pool_address.test.ip_address } `, template) } func (t BackendAddressPoolAddressResourceTests) update(data acceptance.TestData) string { template := t.template(data) return fmt.Sprintf(` provider "azurerm" { features {} } %s resource "azurerm_lb_backend_address_pool_address" "test" { name = "address" backend_address_pool_id = azurerm_lb_backend_address_pool.test.id virtual_network_id = azurerm_virtual_network.test.id ip_address = "172.16.31.10" } `, template) } func (BackendAddressPoolAddressResourceTests) template(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" location = "%s" } resource "azurerm_virtual_network" "test" { name = "acctestvn-%d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name address_space = ["192.168.0.0/16"] } resource "azurerm_public_ip" "test" { name = "acctestpip-%d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name allocation_method = "Static" sku = "Standard" } resource "azurerm_lb" "test" { name = "acctestlb-%d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name sku = "Standard" frontend_ip_configuration { name = "feip" public_ip_address_id = azurerm_public_ip.test.id } } resource "azurerm_lb_backend_address_pool" "test" { name = "internal" loadbalancer_id = azurerm_lb.test.id } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) }
kamenitxan/Jakon
src/test/scala/core/pagelet/TestJsonPagelet.scala
package core.pagelet import java.sql.Connection import core.pagelet.entity.TestJsonPageletData import cz.kamenitxan.jakon.core.dynamic.entity.JsonFailResponse import cz.kamenitxan.jakon.core.dynamic.{AbstractJsonPagelet, Get, JsonPagelet, Post} import spark.{Request, Response} /** * Created by TPa on 13.04.2020. */ @JsonPagelet(path = "jsonPagelet") class TestJsonPagelet extends AbstractJsonPagelet { @Get(path = "/get") def get(req: Request, res: Response): String = { "string" } @Get(path = "/getResponse") def getResponse(req: Request, res: Response): JsonFailResponse = { new JsonFailResponse("some_message") } @Get(path = "/throw") def throwEx(req: Request, res: Response): String = { throw new IllegalAccessException() } @Get(path = "/withDataAndConnection") def withDataAndConnection(req: Request, res: Response, data: TestJsonPageletData, conn: Connection): String = { data.msg } @Post(path = "/post") def post(req: Request, res: Response): String = { "string" } @Post(path = "/postNoValidation", validate = false) def postNoValidation(req: Request, res: Response): String = { "string" } @Post(path = "/postThrow") def postThrowEx(req: Request, res: Response): String = { throw new IllegalAccessException() } @Post(path = "/postWithDataAndConnection") def postWithDataAndConnection(req: Request, res: Response, data: TestJsonPageletData, conn: Connection): String = { data.msg } @Post(path = "/postValidate") def postValidate(req: Request, res: Response, data: TestJsonPageletData): String = { "validation_ok" } }
HeyLey/catboost
library/netliba/v12/local_ip_params.cpp
<gh_stars>1000+ #include "stdafx.h" #include "local_ip_params.h" namespace NNetliba_v12 { static ui32 GetIPv6SuffixCrc(const sockaddr_in6& addr) { TIPv6AddrUnion a; a.Addr = addr.sin6_addr; const ui64 suffix = a.Addr64[1]; return (suffix & 0xffffffffll) + (suffix >> 32); } ui32 CalcAddressChecksum(const sockaddr_in6& addr) { Y_ASSERT(addr.sin6_family == AF_INET6); if (GetIpType(addr) == IPv4) { TIPv6AddrUnion a; a.Addr = addr.sin6_addr; return a.Addr32[3]; } else { return GetIPv6SuffixCrc(addr); } } static ui32 CalcAddressCrcImpl(const TUdpAddress& addr) { sockaddr_in6 addr6; GetWinsockAddr(&addr6, addr); return CalcAddressChecksum(addr6); } ui32 CalcAddressChecksum(const TUdpAddress& addr) { if (addr.IsIPv4()) { Y_ASSERT(addr.GetIPv4() == CalcAddressCrcImpl(addr)); return addr.GetIPv4(); } return CalcAddressCrcImpl(addr); } bool TLocalIpParams::Init() { TVector<TUdpAddress> addrs; if (!GetLocalAddresses(&addrs)) return false; for (int i = 0; i < addrs.ysize(); ++i) { const TUdpAddress& addr = addrs[i]; const ui32 crc = CalcAddressChecksum(addr); if (addr.IsIPv4()) { LocalIPListCrcs[IPv4].push_back(crc); } else { LocalIPListCrcs[IPv6].push_back(crc); LocaIPv6List.push_back(TIPv6Addr(addr.Network, addr.Interface)); } } return true; } bool TLocalIpParams::IsLocal(const TUdpAddress& addr) const { if (addr.IsIPv4()) { return IsIn(LocalIPListCrcs[IPv4], addr.GetIPv4()); } else { return IsIn(LocaIPv6List, TIPv6Addr(addr.Network, addr.Interface)); } } }
hjki456789/reportBuild
src/main/java/com/jump/utils/property/EnBizEnumProperty.java
package com.jump.utils.property; import com.google.common.collect.Maps; import java.util.List; import java.util.Map; /** * @author Jump * @date 2020/3/9 14:09 */ public class EnBizEnumProperty extends AbstractBizEnumProperty { private static Map<String,Map> propertyMap = Maps.newHashMap(); private static Map<String,List<Map<String,String>>> propertiesList = Maps.newHashMap(); @Override Map<String, Map> getPropertiesMap() { return propertyMap; } @Override Map<String, List<Map<String, String>>> getPropertiesList() { return propertiesList; } }
gavar/google-front-end-web-developer
frontend-apps/wittr/public/js/settings/index.js
<filename>frontend-apps/wittr/public/js/settings/index.js import TestController from "./TestController"; const settingsForm = document.querySelector(".settings-form"); settingsForm.addEventListener("change", () => { fetch(settingsForm.action, { method: settingsForm.method, body: new FormData(settingsForm), }); }); if (!self.fetch) { document.querySelector(".warning").style.display = "block"; } new TestController(document.querySelector(".tester"));
xiaoliable/EssayClassifier
src/tw/edu/ntu/csie/libsvm/model/svm_print_interface.java
<gh_stars>1-10 package tw.edu.ntu.csie.libsvm.model; public interface svm_print_interface { public void print(String s); }
nablarch/nablarch-common-dao
src/main/java/nablarch/common/dao/NamingConversionUtil.java
<reponame>nablarch/nablarch-common-dao<filename>src/main/java/nablarch/common/dao/NamingConversionUtil.java<gh_stars>0 package nablarch.common.dao; /** * 変数名やクラス名を相互に変換するユーティリティクラス。 * * @author kawasima * @author <NAME> */ public final class NamingConversionUtil { /** 隠蔽コンストラクタ */ private NamingConversionUtil() { } /** * 文字列をアッパーキャメル(パスカルケース)に変換する。 * <p/> * 例: * <pre> * {@code * NamingConversionUtils.camelize("AAA_BBB_CCC"); -> AaaBbbCcc * } * </pre> * * @param value 文字列(スネークケースを想定) * @return 変換後の文字列 */ public static String camelize(String value) { if (value == null) { return null; } String[] tokens = value.split("_"); StringBuilder camelized = new StringBuilder(value.length()); for (String token : tokens) { for (int i = 0; i < token.length(); i++) { if (i == 0) { camelized.append(Character.toUpperCase(token.charAt(i))); } else { camelized.append(Character.toLowerCase(token.charAt(i))); } } } return camelized.toString(); } /** * アーパーキャメル(パスカルケース)の文字列を全て大文字のスネークケースに変換する。 * <p/> * 例: * <pre> * {@code * NamingConversionUtils.decamelize("AbcAbcAbc"); -> ABC_ABC_ABC * } * </pre> * * @param value 文字列(アッパーキャメルを想定) * @return 変換後の文字列 */ public static String deCamelize(String value) { if (value == null) { return null; } StringBuilder deCamelized = new StringBuilder(value.length() + 10); for (int i = 0; i < value.length(); i++) { if (Character.isUpperCase(value.charAt(i)) && deCamelized.length() > 0) { deCamelized.append('_'); } deCamelized.append(Character.toUpperCase(value.charAt(i))); } return deCamelized.toString(); } }
thalida/wordbird
extension/public/app/app.module.js
'use strict'; angular .module( 'app', [ require('angular-animate'), require('angular-resource'), require('angular-sanitize'), require('angular-touch'), require('angular-ui-router'), require('angular-messages') ]) .config( require('./app.routes.js') );
14ms/Minecraft-Disclosed-Source-Modifications
Skizzle/us/myles/viaversion/bukkit/handlers/BukkitDecodeHandler.java
/* * Decompiled with CFR 0.150. * * Could not load the following classes: * io.netty.buffer.ByteBuf * io.netty.channel.ChannelHandlerContext * io.netty.handler.codec.ByteToMessageDecoder */ package us.myles.ViaVersion.bukkit.handlers; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; import java.lang.reflect.InvocationTargetException; import java.util.List; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.bukkit.util.NMSUtil; import us.myles.ViaVersion.exception.CancelCodecException; import us.myles.ViaVersion.exception.CancelDecoderException; import us.myles.ViaVersion.exception.InformativeException; import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.util.PipelineUtil; public class BukkitDecodeHandler extends ByteToMessageDecoder { private final ByteToMessageDecoder minecraftDecoder; private final UserConnection info; public BukkitDecodeHandler(UserConnection info, ByteToMessageDecoder minecraftDecoder) { this.info = info; this.minecraftDecoder = minecraftDecoder; } /* * WARNING - Removed try catching itself - possible behaviour change. */ protected void decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> list) throws Exception { if (!this.info.checkIncomingPacket()) { bytebuf.clear(); throw CancelDecoderException.generate(null); } ByteBuf transformedBuf = null; try { if (this.info.shouldTransformPacket()) { transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf); this.info.transformIncoming(transformedBuf, CancelDecoderException::generate); } try { list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, (Object)(transformedBuf == null ? bytebuf : transformedBuf))); } catch (InvocationTargetException e) { if (e.getCause() instanceof Exception) { throw (Exception)e.getCause(); } if (e.getCause() instanceof Error) { throw (Error)e.getCause(); } } } finally { if (transformedBuf != null) { transformedBuf.release(); } } } public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (PipelineUtil.containsCause(cause, CancelCodecException.class)) { return; } super.exceptionCaught(ctx, cause); if (!NMSUtil.isDebugPropertySet() && PipelineUtil.containsCause(cause, InformativeException.class) && (this.info.getProtocolInfo().getState() != State.HANDSHAKE || Via.getManager().isDebug())) { cause.printStackTrace(); } } }
sho25/hive
itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestAuthorizerHandler.java
begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1 begin_comment comment|/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ end_comment begin_package package|package name|org operator|. name|apache operator|. name|hadoop operator|. name|hive operator|. name|ql operator|. name|qoption package|; end_package begin_import import|import name|org operator|. name|apache operator|. name|hadoop operator|. name|hive operator|. name|ql operator|. name|QTestUtil import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|hadoop operator|. name|hive operator|. name|ql operator|. name|session operator|. name|SessionState import|; end_import begin_comment comment|/** * QTest authorizer option * * Enables authorization for the qtest. * * Example: * --! qt:authorizer */ end_comment begin_class specifier|public class|class name|QTestAuthorizerHandler implements|implements name|QTestOptionHandler block|{ specifier|private name|boolean name|enabled decl_stmt|; annotation|@ name|Override specifier|public name|void name|processArguments parameter_list|( name|String name|arguments parameter_list|) block|{ name|enabled operator|= literal|true expr_stmt|; block|} annotation|@ name|Override specifier|public name|void name|beforeTest parameter_list|( name|QTestUtil name|qt parameter_list|) throws|throws name|Exception block|{ if|if condition|( name|enabled condition|) block|{ name|qt operator|. name|getConf argument_list|() operator|. name|set argument_list|( literal|"hive.test.authz.sstd.hs2.mode" argument_list|, literal|"true" argument_list|) expr_stmt|; name|qt operator|. name|getConf argument_list|() operator|. name|set argument_list|( literal|"hive.security.authorization.manager" argument_list|, literal|"org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactoryForTest" argument_list|) expr_stmt|; name|qt operator|. name|getConf argument_list|() operator|. name|set argument_list|( literal|"hive.security.authenticator.manager" argument_list|, literal|"org.apache.hadoop.hive.ql.security.SessionStateConfigUserAuthenticator" argument_list|) expr_stmt|; name|qt operator|. name|getConf argument_list|() operator|. name|set argument_list|( literal|"hive.security.authorization.enabled" argument_list|, literal|"true" argument_list|) expr_stmt|; name|SessionState operator|. name|get argument_list|() operator|. name|setAuthenticator argument_list|( literal|null argument_list|) expr_stmt|; name|SessionState operator|. name|get argument_list|() operator|. name|setAuthorizer argument_list|( literal|null argument_list|) expr_stmt|; block|} block|} annotation|@ name|Override specifier|public name|void name|afterTest parameter_list|( name|QTestUtil name|qt parameter_list|) throws|throws name|Exception block|{ name|enabled operator|= literal|false expr_stmt|; block|} block|} end_class end_unit
JurrianFahner/ipf
commons/audit/src/main/java/org/openehealth/ipf/commons/audit/event/AuditMessageBuilder.java
/* * Copyright 2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openehealth.ipf.commons.audit.event; import org.openehealth.ipf.commons.audit.model.AuditMessage; import org.openehealth.ipf.commons.audit.model.TypeValuePairType; import org.openehealth.ipf.commons.audit.model.Validateable; /** * Base interface for building DICOM audit messages * * @author <NAME> * @since 3.5 */ public interface AuditMessageBuilder<T extends AuditMessageBuilder<T>> extends Validateable { /** * @return the audit message being built */ AuditMessage getMessage(); /** * @return the audit message being built as only element in an array */ default AuditMessage[] getMessages() { return new AuditMessage[]{getMessage()}; } /** * Create and set a Type Value Pair instance for a given type and value * * @param type the type to set * @param value the value to set * @return the Type Value Pair instance */ default TypeValuePairType getTypeValuePair(String type, Object value) { return getTypeValuePair(type, value, null); } /** * Create and set a Type Value Pair instance for a given type and value * * @param type the type to set * @param value the value to set * @return the Type Value Pair instance */ default TypeValuePairType getTypeValuePair(String type, byte[] value) { return getTypeValuePair(type, value, (byte[])null); } /** * Create and set a Type Value Pair instance for a given type and value * * @param type the type to set * @param value the value to set * @param defaultValue the value to set if value is null * @return the Type Value Pair instance */ default TypeValuePairType getTypeValuePair(String type, Object value, String defaultValue) { return new TypeValuePairType( type, value != null ? value.toString() : null, defaultValue); } /** * Create and set a Type Value Pair instance for a given type and value * * @param type the type to set * @param value the value to set * @param defaultValue the value to set if value is null * @return the Type Value Pair instance */ default TypeValuePairType getTypeValuePair(String type, byte[] value, byte[] defaultValue) { return new TypeValuePairType( type, value != null ? value : null, defaultValue); } /** * @return this builder */ @SuppressWarnings("unchecked") default T self() { return (T) this; } }
Samuel-Rubin621/CS498
TowerDefense/Intermediate/Plugins/NativizedAssets/Windows/Game/Intermediate/Build/Win64/UE4/Inc/NativizedAssets/Struct_Green__pf3140832796.generated.h
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/ObjectMacros.h" #include "UObject/ScriptMacros.h" PRAGMA_DISABLE_DEPRECATION_WARNINGS #ifdef NATIVIZEDASSETS_Struct_Green__pf3140832796_generated_h #error "Struct_Green__pf3140832796.generated.h already included, missing '#pragma once' in Struct_Green__pf3140832796.h" #endif #define NATIVIZEDASSETS_Struct_Green__pf3140832796_generated_h #define TowerDefense_Intermediate_Plugins_NativizedAssets_Windows_Game_Source_NativizedAssets_Public_Struct_Green__pf3140832796_h_11_GENERATED_BODY \ friend struct Z_Construct_UScriptStruct_FStruct_Green__pf3140832796_Statics; \ NATIVIZEDASSETS_API static class UScriptStruct* StaticStruct(); template<> NATIVIZEDASSETS_API UScriptStruct* StaticStruct<struct FStruct_Green__pf3140832796>(); #undef CURRENT_FILE_ID #define CURRENT_FILE_ID TowerDefense_Intermediate_Plugins_NativizedAssets_Windows_Game_Source_NativizedAssets_Public_Struct_Green__pf3140832796_h PRAGMA_ENABLE_DEPRECATION_WARNINGS
qiqingfu/examples-1
unittest/test/extend/request.test.js
<gh_stars>1000+ 'use strict'; const assert = require('assert'); const mock = require('egg-mock'); describe('test/extend/request.test.js', () => { let app; before(() => { app = mock.app(); return app.ready(); }); describe('isChrome()', () => { it('should true', () => { const ctx = app.mockContext({ headers: { 'User-Agent': 'Chrome/56.0.2924.51', }, }); assert(ctx.request.isChrome === true); }); it('should false', () => { const ctx = app.mockContext({ headers: { 'User-Agent': 'FireFox/1', }, }); assert(ctx.request.isChrome === false); }); }); });
bonsaiERP/bonsaiERP
db/migrate/20130702144114_add_tables_updater_id.rb
<reponame>bonsaiERP/bonsaiERP class AddTablesUpdaterId < ActiveRecord::Migration def up PgTools.with_schemas except: 'common' do add_column :account_ledgers, :updater_id, :integer add_index :account_ledgers, :updater_id add_column :accounts, :updater_id, :integer add_index :accounts, :updater_id add_column :inventories, :updater_id, :integer add_index :inventories, :updater_id end end def down PgTools.with_schemas except: 'common' do remove_column :account_ledgers, :updater_id remove_column :accounts, :updater_id remove_column :inventories, :updater_id end end end
quanpands/wflow
pcraster/pcraster-4.2.0/pcraster-4.2.0/source/fern/source/fern/language/io/uncertml2/uncertml2_parser.h
<reponame>quanpands/wflow<gh_stars>0 // ----------------------------------------------------------------------------- // Fern © Geoneric // // This file is part of Geoneric Fern which is available under the terms of // the GNU General Public License (GPL), version 2. If you do not want to // be bound by the terms of the GPL, you may purchase a proprietary license // from Geoneric (http://www.geoneric.eu/contact). // ----------------------------------------------------------------------------- #pragma once #include <memory> #include <string> namespace fern { class Uncertainty; //! TODO /*! TODO */ class UncertML2Parser { public: UncertML2Parser ()=default; ~UncertML2Parser ()=default; UncertML2Parser (UncertML2Parser&&)=delete; UncertML2Parser& operator= (UncertML2Parser&&)=delete; UncertML2Parser (UncertML2Parser const&)=delete; UncertML2Parser& operator= (UncertML2Parser const&)=delete; std::shared_ptr<Uncertainty> parse (std::string const& xml) const; private: std::shared_ptr<Uncertainty> parse (std::istream& stream) const; }; } // namespace fern
dwws-ufes/2020-UMDb
umdb-app-server/src-gen/main/java/com/ufes/inf/dwws/umdb/persistence/MovieDAOJPA.java
package com.ufes.inf.dwws.umdb.persistence; import org.springframework.stereotype.Repository; import javax.persistence.PersistenceContext; @Repository public class MovieDAOJPA implements MovieDAOJPA{ @PersistenceContext EntityManager entityManager; @Override public Movie getByID(Long id) { // TODO Auto-generated method stub return null; } @Override public Movie getAllByGenre(Genre genre) { // TODO Auto-generated method stub return null; } @Override public Movie getAllByActor(Actor actor) { // TODO Auto-generated method stub return null; } @Override public Movie getAllByDirector(Director director) { // TODO Auto-generated method stub return null; } @Override public Movie getByName(String name) { // TODO Auto-generated method stub return null; } @Override public Movie getWithReviews(Long id) { // TODO Auto-generated method stub return null; } @Override public Movie getAll() { // TODO Auto-generated method stub return null; } @Override public Movie filter(String genre, String director, String actor) { // TODO Auto-generated method stub return null; } @Override public Movie getWithActorsAndGenresAndDirector(Long id) { // TODO Auto-generated method stub return null; } @Override public Movie getWithActorsAndGenresAndDirectorAndReviews(Long id) { // TODO Auto-generated method stub return null; } }
erdincozden/xs2a
consent-management/consent-xs2a-web/src/main/java/de/adorsys/psd2/consent/web/xs2a/controller/EventController.java
<reponame>erdincozden/xs2a<gh_stars>0 /* * Copyright 2018-2018 adorsys GmbH & Co KG * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.adorsys.psd2.consent.web.xs2a.controller; import de.adorsys.psd2.consent.api.service.EventServiceEncrypted; import de.adorsys.psd2.xs2a.core.event.Event; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor @RequestMapping(path = "api/v1/events") @Api(value = "api/v1/events", tags = "Events", description = "Provides access to the consent management system for Events") public class EventController { private final EventServiceEncrypted eventService; @PostMapping(path = "/") @ApiOperation(value = "Creates new event") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Bad Request")}) public ResponseEntity<Boolean> recordEvent(@RequestBody Event event) { return new ResponseEntity<>(eventService.recordEvent(event), HttpStatus.OK); } }
bengarrett/sauce
internal/layout/binarytext_test.go
<reponame>bengarrett/sauce // This is a raw memory copy of a text mode screen. Also known as a .BIN file. // This is essentially a collection of character and attribute pairs. // See http://www.acid.org/info/sauce/sauce.htm#FileType package layout import "testing" func TestBinaryText_String(t *testing.T) { tests := []struct { name string b BinaryText want string }{ {"out of range", 999, ""}, {"first and last", 0, "Binary text or a .BIN file"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.b.String(); got != tt.want { t.Errorf("BinaryText.String() = %v, want %v", got, tt.want) } }) } }
esavard/SoulEVSpy
app/src/main/java/com/evranger/elm327/commands/protocol/can/CANSetProtocolCommand.java
package com.evranger.elm327.commands.protocol.can; import com.evranger.elm327.commands.AbstractCommand; /** * Created by <NAME> <<EMAIL>> on 2015-10-25. */ public class CANSetProtocolCommand extends AbstractCommand { public CANSetProtocolCommand(int protocolNo) { super("AT SPA" + protocolNo); } }
acostapazo/event-manager
tests/modules/tasks/create/acceptance/test_post_task.py
import json import pytest @pytest.mark.acceptance def test_should_return_a_200_when_post_task( client, database, given_any_title, given_any_description ): headers = {"Content-type": "application/json", "Accept": "text/plain"} data = {"title": given_any_title, "description": given_any_description} response = client.post("/taskmanager/task", data=json.dumps(data), headers=headers) assert response.status_code == 200 assert "task_id" in response.json assert len(response.json["task_id"]) == 16 assert response.json["message"] == "Created Task" @pytest.mark.acceptance def test_should_return_a_405_when_post_task_with_no_data( client, database, given_any_title, given_any_description ): headers = {"Content-type": "application/json", "Accept": "text/plain"} data = {} response = client.post("/taskmanager/task", data=json.dumps(data), headers=headers) assert response.status_code == 400 @pytest.mark.acceptance def test_should_return_a_400_when_post_task_with_no_title( client, database, given_any_description ): headers = {"Content-type": "application/json", "Accept": "text/plain"} data = {"description": given_any_description} response = client.post("/taskmanager/task", data=json.dumps(data), headers=headers) assert response.status_code == 400 @pytest.mark.acceptance def test_should_return_a_400_when_post_task_with_no_description( client, given_any_title ): headers = {"Content-type": "application/json", "Accept": "text/plain"} data = {"title": given_any_title} response = client.post("/taskmanager/task", data=json.dumps(data), headers=headers) assert response.status_code == 400 @pytest.mark.acceptance def test_should_return_a_405_when_post_task_with_title_exceeds_length( client, given_any_title, given_any_description ): headers = {"Content-type": "application/json", "Accept": "text/plain"} data = {"title": given_any_title * 20, "description": given_any_description} response = client.post("/taskmanager/task", data=json.dumps(data), headers=headers) assert response.status_code == 405 assert response.json == { "error": { "message": "Exceed Length Limit", "type": "ExceedLengthLimitInputError", } } @pytest.mark.acceptance def test_should_return_a_405_when_post_task_with_description_exceeds_length( client, given_any_title, given_any_description ): headers = {"Content-type": "application/json", "Accept": "text/plain"} data = {"title": given_any_title, "description": given_any_description * 200} response = client.post("/taskmanager/task", data=json.dumps(data), headers=headers) assert response.status_code == 405 assert response.json == { "error": { "message": "Exceed Length Limit", "type": "ExceedLengthLimitInputError", } }
lastweek/source-freebsd
src/sys/mips/atheros/ar531x/ar5312_chip.c
<gh_stars>0 /*- * Copyright (c) 2016 <NAME> * Copyright (c) 2010 <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include <sys/param.h> #include <sys/conf.h> #include <sys/kernel.h> #include <sys/socket.h> #include <sys/systm.h> #include <sys/bus.h> #include <sys/cons.h> #include <sys/kdb.h> #include <sys/reboot.h> #include <vm/vm.h> #include <vm/vm_page.h> #include <net/ethernet.h> #include <machine/clock.h> #include <machine/cpu.h> #include <machine/cpuregs.h> #include <machine/hwfunc.h> #include <machine/md_var.h> #include <machine/trap.h> #include <machine/vmparam.h> #include <mips/atheros/ar531x/ar5312reg.h> #include <mips/atheros/ar531x/ar5315reg.h> #include <mips/atheros/ar531x/ar5315_cpudef.h> #include <mips/atheros/ar531x/ar5315_setup.h> static void ar5312_chip_detect_mem_size(void) { uint32_t memsize; uint32_t memcfg, bank0, bank1; /* * Determine the memory size as established by system * firmware. * * NB: we allow compile time override */ memcfg = ATH_READ_REG(AR5312_SDRAMCTL_BASE + AR5312_SDRAMCTL_MEM_CFG1); bank0 = __SHIFTOUT(memcfg, AR5312_MEM_CFG1_BANK0); bank1 = __SHIFTOUT(memcfg, AR5312_MEM_CFG1_BANK1); memsize = (bank0 ? (1 << (bank0 + 1)) : 0) + (bank1 ? (1 << (bank1 + 1)) : 0); memsize <<= 20; realmem = memsize; } static void ar5312_chip_detect_sys_frequency(void) { uint32_t predivisor; uint32_t multiplier; const uint32_t clockctl = ATH_READ_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_CLOCKCTL); if(ar531x_soc == AR531X_SOC_AR5313) { predivisor = __SHIFTOUT(clockctl, AR2313_CLOCKCTL_PREDIVIDE); multiplier = __SHIFTOUT(clockctl, AR2313_CLOCKCTL_MULTIPLIER); } else { predivisor = __SHIFTOUT(clockctl, AR5312_CLOCKCTL_PREDIVIDE); multiplier = __SHIFTOUT(clockctl, AR5312_CLOCKCTL_MULTIPLIER); } const uint32_t divisor = (0x5421 >> (predivisor * 4)) & 15; const uint32_t cpufreq = (40000000 / divisor) * multiplier; u_ar531x_cpu_freq = cpufreq; u_ar531x_ahb_freq = cpufreq / 4; u_ar531x_ddr_freq = 0; } /* * This does not lock the CPU whilst doing the work! */ static void ar5312_chip_device_reset(void) { ATH_WRITE_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_RESETCTL, AR5312_RESET_SYSTEM); } static void ar5312_chip_device_start(void) { uint32_t cfg0, cfg1; uint32_t bank0, bank1; uint32_t size0, size1; cfg0 = ATH_READ_REG(AR5312_SDRAMCTL_BASE + AR5312_SDRAMCTL_MEM_CFG0); cfg1 = ATH_READ_REG(AR5312_SDRAMCTL_BASE + AR5312_SDRAMCTL_MEM_CFG1); bank0 = __SHIFTOUT(cfg1, AR5312_MEM_CFG1_BANK0); bank1 = __SHIFTOUT(cfg1, AR5312_MEM_CFG1_BANK1); size0 = bank0 ? (1 << (bank0 + 1)) : 0; size1 = bank1 ? (1 << (bank1 + 1)) : 0; size0 <<= 20; size1 <<= 20; printf("SDRMCTL %x %x %x %x\n", cfg0, cfg1, size0, size1); ATH_READ_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_AHBPERR); ATH_READ_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_AHBDMAE); // ATH_WRITE_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_WDOG_CTL, 0); ATH_WRITE_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_ENABLE, 0); ATH_WRITE_REG(AR5312_SYSREG_BASE+AR5312_SYSREG_ENABLE, ATH_READ_REG(AR5312_SYSREG_BASE+AR5312_SYSREG_ENABLE) | AR5312_ENABLE_ENET0 | AR5312_ENABLE_ENET1); } static int ar5312_chip_device_stopped(uint32_t mask) { uint32_t reg; reg = ATH_READ_REG(AR5312_SYSREG_BASE + AR5312_SYSREG_RESETCTL); return ((reg & mask) == mask); } static void ar5312_chip_set_mii_speed(uint32_t unit, uint32_t speed) { } /* Speed is either 10, 100 or 1000 */ static void ar5312_chip_set_pll_ge(int unit, int speed) { } static void ar5312_chip_ddr_flush_ge(int unit) { } static void ar5312_chip_soc_init(void) { u_ar531x_uart_addr = MIPS_PHYS_TO_KSEG1(AR5312_UART0_BASE); u_ar531x_gpio_di = AR5312_GPIO_DI; u_ar531x_gpio_do = AR5312_GPIO_DO; u_ar531x_gpio_cr = AR5312_GPIO_CR; u_ar531x_gpio_pins = AR5312_GPIO_PINS; u_ar531x_wdog_ctl = AR5312_SYSREG_WDOG_CTL; u_ar531x_wdog_timer = AR5312_SYSREG_WDOG_TIMER; } static uint32_t ar5312_chip_get_eth_pll(unsigned int mac, int speed) { return 0; } struct ar5315_cpu_def ar5312_chip_def = { &ar5312_chip_detect_mem_size, &ar5312_chip_detect_sys_frequency, &ar5312_chip_device_reset, &ar5312_chip_device_start, &ar5312_chip_device_stopped, &ar5312_chip_set_pll_ge, &ar5312_chip_set_mii_speed, &ar5312_chip_ddr_flush_ge, &ar5312_chip_get_eth_pll, &ar5312_chip_soc_init, };
khangaikhuu-mstars/mstars-exercises
Baatarkhuu/Async programming/11.29/Exercise-01/app.js
<gh_stars>0 // const myPromise = new Promise((resolve, reject) => { // const xhr = new XMLHttpRequest(); // xhr.open("GET", "sidebar.html"); // xhr.onreadystatechange = function () { // if (!xhr.status == 200) { // document.getElementById("ajax").innerHTML = xhr.responseText; // return resolve("It is working"); // }else { // return reject('Reject is working'); // } // }; // xhr.send(); // }); // myPromise.then((data) => { // console.log(data) // }).catch((error) => console.log(error)) // console.log(myPromise); const btn = document.getElementById("button") const myPromise = new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open("GET", "sidebar.html"); xhr.onreadystatechange = function () { if (xhr.status == 200) { return resolve("It is working"); }else { return reject('Not found'); } }; xhr.send(); }); myPromise.then((data) => { document.getElementById('ajax').innerHTML = `<div><h1>${data}<h1></div>` }).catch((error) => document.getElementById("ajax").innerHTML = `<div><h1>${error}<h1></div>`) .finally(() => {btn.style.display = "none"});
larsbratholm/champs_kaggle
solutions/12/src/cormorant/tests/cormorant_tests.py
import torch from torch.utils.data import DataLoader import logging from cormorant.cg_lib import rotations as rot from cormorant.data import collate_fn def _gen_rot(data, angles, maxl): alpha, beta, gamma = angles D = rot.WignerD_list(maxl, alpha, beta, gamma) R = rot.EulerRot(alpha, beta, gamma) return D, R def covariance_test(model, data): logging.info('Beginning covariance test!') targets_rotout, outputs_rotin = [], [] angles = torch.rand(3) D, R = _gen_rot(data, angles, max(model.maxl)) data_rotout = data data_rotin = {key: val.clone() if type(val) is torch.Tensor else None for key, val in data.items()} data_rotin['positions'] = rot.rotate_cart_vec(R, data_rotin['positions']) outputs_rotout, reps_rotout, _ = model(data_rotout, covariance_test=True) outputs_rotin, reps_rotin, _ = model(data_rotin, covariance_test=True) reps_rotout, reps_rotin = reps_rotout[0], reps_rotin[0] invariance_test = (outputs_rotout - outputs_rotin).norm() reps_rotout = [rot.rotate_rep(D, reps) for reps in reps_rotout] covariance_test_norm = [[(part_in - part_out).norm().item() for (part_in, part_out) in zip(level_in, level_out)] for (level_in, level_out) in zip(reps_rotin, reps_rotout)] covariance_test_mean = [[(part_in - part_out).abs().mean().item() for (part_in, part_out) in zip(level_in, level_out)] for (level_in, level_out) in zip(reps_rotin, reps_rotout)] covariance_test_max = torch.cat([torch.tensor([(part_in - part_out).abs().max().item() for (part_in, part_out) in zip(level_in, level_out)]) for (level_in, level_out) in zip(reps_rotin, reps_rotout)]) covariance_test_max = covariance_test_max.max().item() if set([len(part) for part in reps_rotout]) == 1: covariance_test_norm = torch.tensor(covariance_test_norm) covariance_test_mean = torch.tensor(covariance_test_mean) else: covariance_test_norm = [torch.tensor(p) for p in covariance_test_norm] covariance_test_mean = [torch.tensor(p) for p in covariance_test_mean] logging.info('Rotation Invariance test: {:0.5g}'.format(invariance_test)) logging.info('Largest deviation in covariance test : {:0.5g}'.format(covariance_test_max)) # If the largest deviation in the covariance test is greater than 1e-5, # display l1 and l2 norms of each irrep along each level. if covariance_test_max > 1e-5: logging.warning('Largest deviation in covariance test {:0.5g} detected! Detailed summary:'.format(covariance_test_max)) for lvl_idx, (lvl_norm, lvl_mean) in enumerate(zip(covariance_test_norm, covariance_test_mean)): for ell_idx, (ell_norm, ell_mean) in enumerate(zip(lvl_norm, lvl_mean)): logging.warning('(lvl, ell) = ({}, {}) -> {:0.5g} (mean) {:0.5g} (max)'.format(lvl_idx, ell_idx, ell_norm, ell_mean)) def permutation_test(model, data): logging.info('Beginning permutation test!') mask = data['atom_mask'] # Generate a list of indices for each molecule. # We will generate a permutation only for the atoms that exist (are not masked.) perm = 1*torch.arange(mask.shape[1]).expand(mask.shape[0], -1) for idx in range(mask.shape[0]): num_atoms = (mask[idx, :].long()).sum() perm[idx, :num_atoms] = torch.randperm(num_atoms) apply_perm = lambda mat: torch.stack([mat[idx, p] for (idx, p) in enumerate(perm)]) assert((mask == apply_perm(mask)).all()) data_noperm = data data_perm = {key: apply_perm(val) if torch.is_tensor(val) and val.dim() > 1 else val for key, val in data.items()} outputs_perm = model(data_perm) outputs_noperm = model(data_noperm) invariance_test = (outputs_perm - outputs_noperm).abs().max() logging.info('Permutation Invariance test: {}'.format(invariance_test)) def batch_test(model, data): logging.info('Beginning batch invariance test!') data_split = {key: val.unbind(dim=0) if (torch.is_tensor(val) and val.numel() > 1) else val for key, val in data.items()} data_split = [{key: val[idx].unsqueeze(0) if type(val) is tuple else val for key, val in data_split.items()} for idx in range(len(data['charges']))] outputs_split = torch.cat([model(data_sub) for data_sub in data_split]) outputs_full = model(data) invariance_test = (outputs_split - outputs_full).abs().max() logging.info('Batch invariance test: {}'.format(invariance_test)) def cormorant_tests(model, dataloader, args, tests=['covariance'], charge_scale=1): if not args.test: logging.info("WARNING: network tests disabled!") return logging.info("Testing network for symmetries:") model.eval() charge_power, num_species = model.charge_power, model.num_species data = next(iter(dataloader)) covariance_test(model, data) permutation_test(model, data) batch_test(model, data) logging.info('Test complete!')
Emersonxuelinux/aliyun-odps-python-sdk
odps/models/tests/test_partitions.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2017 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from datetime import datetime from odps.tests.core import TestBase, tn from odps.compat import unittest from odps.models import Schema from odps import types class Test(TestBase): def testPartitions(self): test_table_name = tn('pyodps_t_tmp_partitions_table') partitions = ['s=%s' % i for i in range(3)] schema = Schema.from_lists(['id', ], ['string', ], ['s', ], ['string', ]) self.odps.delete_table(test_table_name, if_exists=True) table = self.odps.create_table(test_table_name, schema) for partition in partitions: table.create_partition(partition) self.assertEqual(sorted([str(types.PartitionSpec(p)) for p in partitions]), sorted([str(p.partition_spec) for p in table.partitions])) table.get_partition(partitions[0]).drop() self.assertEqual(sorted([str(types.PartitionSpec(p)) for p in partitions[1:]]), sorted([str(p.partition_spec) for p in table.partitions])) p = next(table.partitions) self.assertGreater(len(p.columns), 0) p.reload() self.assertGreater(len(p.columns), 0) self.odps.delete_table(test_table_name) def testSubPartitions(self): test_table_name = tn('pyodps_t_tmp_sub_partitions_table') root_partition = 'type=test' sub_partitions = ['s=%s' % i for i in range(3)] schema = Schema.from_lists(['id', ], ['string', ], ['type', 's'], ['string', 'string']) self.odps.delete_table(test_table_name, if_exists=True) table = self.odps.create_table(test_table_name, schema) partitions = [root_partition+','+p for p in sub_partitions] partitions.append('type=test2,s=0') for partition in partitions: table.create_partition(partition) self.assertEqual(sorted([str(types.PartitionSpec(p)) for p in partitions]), sorted([str(p.partition_spec) for p in table.partitions])) self.assertEqual(len(list(table.iterate_partitions(root_partition))), 3) table.delete_partition(partitions[0]) self.assertEqual(sorted([str(types.PartitionSpec(p)) for p in partitions[1:]]), sorted([str(p.partition_spec) for p in table.partitions])) self.odps.delete_table(test_table_name) def testPartition(self): test_table_name = tn('pyodps_t_tmp_partition_table') partition = 's=1' schema = Schema.from_lists(['id', ], ['string', ], ['s', ], ['string', ]) self.odps.delete_table(test_table_name, if_exists=True) table = self.odps.create_table(test_table_name, schema) partition = table.create_partition(partition) self.assertFalse(partition._getattr('_is_extend_info_loaded')) self.assertFalse(partition._getattr('_loaded')) self.assertIsNone(partition._getattr('creation_time')) self.assertIsNone(partition._getattr('last_meta_modified_time')) self.assertIsNone(partition._getattr('last_modified_time')) self.assertIsNone(partition._getattr('size')) self.assertIsNone(partition._getattr('is_archived')) self.assertIsNone(partition._getattr('is_exstore')) self.assertIsNone(partition._getattr('lifecycle')) self.assertIsNone(partition._getattr('physical_size')) self.assertIsNone(partition._getattr('file_num')) self.assertIsInstance(partition.is_archived, bool) self.assertIsInstance(partition.is_exstore, bool) self.assertIsInstance(partition.lifecycle, int) self.assertIsInstance(partition.physical_size, int) self.assertIsInstance(partition.file_num, int) self.assertIsInstance(partition.creation_time, datetime) self.assertIsInstance(partition.last_meta_modified_time, datetime) self.assertIsInstance(partition.last_modified_time, datetime) self.assertIsInstance(partition.size, int) self.assertTrue(partition._is_extend_info_loaded) self.assertTrue(partition.is_loaded) self.assertTrue(table.exist_partition(partition)) self.assertFalse(table.exist_partition('s=a_non_exist_partition')) self.odps.delete_table(test_table_name) self.assertFalse(table.exist_partition(partition)) if __name__ == '__main__': unittest.main()
jiusandeerduo/alumni-database-platform
cloudfunctions/cloud/project/controller/admin/admin_order_controller.js
/** * Notes: 资讯模块后台管理-控制器 * Ver : CCMiniCloud Framework 2.0.1 ALL RIGHTS RESERVED BY <EMAIL> * Date: 2021-07-11 10:20:00 */ const BaseAdminController = require('./base_admin_controller.js'); const AdminOrderService = require('../../service/admin/admin_order_service.js'); const timeUtil = require('../../../framework/utils/time_util.js'); const dataUtil = require('../../../framework/utils/data_util.js'); const contentCheck = require('../../../framework/validate/content_check.js'); class AdminOrderController extends BaseAdminController { /** * 退款 */ async refund() { await this.isAdmin(); // 数据校验 let rules = { id: 'must|id', }; // 取得数据 let input = this.validateData(rules); let service = new AdminOrderService(); await service.refund(input.id); } /** 资讯列表 */ async getOrderList() { await this.isAdmin(); // 数据校验 let rules = { search: 'string|min:1|max:30|name=搜索条件', sortType: 'string|name=搜索类型', sortVal: 'name=搜索类型值', orderBy: 'object|name=排序', whereEx: 'object|name=附加查询条件', page: 'must|int|default=1', size: 'int', isTotal: 'bool', oldTotal: 'int', }; // 取得数据 let input = this.validateData(rules); let service = new AdminOrderService(); let result = await service.getOrderList(input); // 数据格式化 let list = result.list; for (let k in list) { list[k].ORDER_ADD_TIME = timeUtil.timestamp2Time(list[k].ORDER_ADD_TIME); list[k].ORDER_REFUND_TIME = timeUtil.timestamp2Time(list[k].ORDER_REFUND_TIME); } result.list = list; return result; } /************** 数据导出 BEGIN ********************* */ // 当前是否有导出文件生成 async orderDataGet() { await this.isAdmin(); // 数据校验 let rules = {}; // 取得数据 let input = this.validateData(rules); let service = new AdminOrderService(); return await service.getOrderDataURL(); } // 导出数据 async orderDataExport() { await this.isAdmin(); // 数据校验 let rules = { condition: 'string|name=导出条件', }; // 取得数据 let input = this.validateData(rules); let service = new AdminOrderService(); return await service.exportOrderDataExcel(input.condition); } // 删除导出的订单数据 async orderDataDel() { await this.isAdmin(); // 数据校验 let rules = {}; // 取得数据 let input = this.validateData(rules); let service = new AdminOrderService(); return await service.deleteOrderDataExcel(); } /************** 数据导出 END ********************* */ } module.exports = AdminOrderController;
multei/web
src/services/healthcheck.js
import Api from "../api" export const getHealthCheckResponse = () => Api().get("/health-check")
subutai-io/subutai
management/server/subutai-common/src/main/java/io/subutai/common/peer/PeerNotRegisteredException.java
package io.subutai.common.peer; public class PeerNotRegisteredException extends PeerException { public PeerNotRegisteredException() { } public PeerNotRegisteredException( final String message ) { super( message ); } }
jingshuai5213/bus
bus-core/src/main/java/org/aoju/bus/core/toolkit/NameKit.java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2020 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * ********************************************************************************/ package org.aoju.bus.core.toolkit; import java.util.ArrayList; import java.util.List; /** * 生成姓名 * * @author <NAME> * @version 6.0.1 * @since JDK 1.8+ */ public class NameKit { private static List<String> EN_FIRST_LIST = new ArrayList<>(); private static List<String> EN_LAST_LIST = new ArrayList<>(); private static List<String> CN_LAST_NAME = new ArrayList<>(); private static List<String> CN_FIRST_NAME = new ArrayList<>(); static { initEN_FIRST_LIST(); initEN_LAST_LIST(); initCN_LAST_NAME(); initCN_FIRST_NAME(); } public static String getEnName() { String head = EN_FIRST_LIST.get((int) (Math.random() * EN_FIRST_LIST.size())); String tail = EN_LAST_LIST.get((int) (Math.random() * EN_LAST_LIST.size())); return head + tail; } public static String getCnName() { String head = CN_LAST_NAME.get((int) (Math.random() * CN_LAST_NAME.size())); String tail = CN_FIRST_NAME.get((int) (Math.random() * CN_FIRST_NAME.size())); return head + tail; } public static void initEN_FIRST_LIST() { EN_FIRST_LIST.add("Ter"); EN_FIRST_LIST.add("Wind"); EN_FIRST_LIST.add("Buck"); EN_FIRST_LIST.add("Glo"); EN_FIRST_LIST.add("Ray"); EN_FIRST_LIST.add("Black"); EN_FIRST_LIST.add("Bright"); EN_FIRST_LIST.add("Claire"); EN_FIRST_LIST.add("Blithe"); EN_FIRST_LIST.add("O'Ca"); EN_FIRST_LIST.add("Rams"); EN_FIRST_LIST.add("Dawn"); EN_FIRST_LIST.add("Kirk"); EN_FIRST_LIST.add("Beck"); EN_FIRST_LIST.add("Mill"); EN_FIRST_LIST.add("Hob"); EN_FIRST_LIST.add("Hod"); EN_FIRST_LIST.add("Fitch"); EN_FIRST_LIST.add("Wins"); EN_FIRST_LIST.add("Gals"); EN_FIRST_LIST.add("Boyd"); EN_FIRST_LIST.add("Myr"); EN_FIRST_LIST.add("Tours"); EN_FIRST_LIST.add("Hoo"); EN_FIRST_LIST.add("Dave"); EN_FIRST_LIST.add("Steele"); EN_FIRST_LIST.add("Ruth"); EN_FIRST_LIST.add("Brian"); EN_FIRST_LIST.add("Dier"); EN_FIRST_LIST.add("Mike"); EN_FIRST_LIST.add("Hoy"); EN_FIRST_LIST.add("Piers"); EN_FIRST_LIST.add("Lind"); EN_FIRST_LIST.add("Bill"); EN_FIRST_LIST.add("Booth"); EN_FIRST_LIST.add("A"); EN_FIRST_LIST.add("Ab"); EN_FIRST_LIST.add("Ser"); EN_FIRST_LIST.add("June"); EN_FIRST_LIST.add("Ac"); EN_FIRST_LIST.add("B"); EN_FIRST_LIST.add("Ad"); EN_FIRST_LIST.add("E"); EN_FIRST_LIST.add("F"); EN_FIRST_LIST.add("Brews"); EN_FIRST_LIST.add("Ag"); EN_FIRST_LIST.add("Chil"); EN_FIRST_LIST.add("Flo"); EN_FIRST_LIST.add("I"); EN_FIRST_LIST.add("Elroy"); EN_FIRST_LIST.add("Al"); EN_FIRST_LIST.add("L"); EN_FIRST_LIST.add("Tha"); EN_FIRST_LIST.add("An"); EN_FIRST_LIST.add("Paul"); EN_FIRST_LIST.add("O"); EN_FIRST_LIST.add("Beer"); EN_FIRST_LIST.add("Hutt"); EN_FIRST_LIST.add("The"); EN_FIRST_LIST.add("Ar"); EN_FIRST_LIST.add("Leif"); EN_FIRST_LIST.add("As"); EN_FIRST_LIST.add("Baird"); EN_FIRST_LIST.add("S"); EN_FIRST_LIST.add("At"); EN_FIRST_LIST.add("Au"); EN_FIRST_LIST.add("U"); EN_FIRST_LIST.add("Stra"); EN_FIRST_LIST.add("Jud"); EN_FIRST_LIST.add("Tho"); EN_FIRST_LIST.add("Dia"); EN_FIRST_LIST.add("Doug"); EN_FIRST_LIST.add("God"); EN_FIRST_LIST.add("Fast"); EN_FIRST_LIST.add("Ba"); EN_FIRST_LIST.add("Bea"); EN_FIRST_LIST.add("Lyn"); EN_FIRST_LIST.add("Walsh"); EN_FIRST_LIST.add("Be"); EN_FIRST_LIST.add("Dil"); EN_FIRST_LIST.add("Lyt"); EN_FIRST_LIST.add("Bi"); EN_FIRST_LIST.add("Bel"); EN_FIRST_LIST.add("Scrip"); EN_FIRST_LIST.add("Jus"); EN_FIRST_LIST.add("Ben"); EN_FIRST_LIST.add("Gos"); EN_FIRST_LIST.add("Gor"); EN_FIRST_LIST.add("Bo"); EN_FIRST_LIST.add("Hicks"); EN_FIRST_LIST.add("Ber"); EN_FIRST_LIST.add("Tris"); EN_FIRST_LIST.add("Bet"); EN_FIRST_LIST.add("Tif"); EN_FIRST_LIST.add("Hale"); EN_FIRST_LIST.add("Bes"); EN_FIRST_LIST.add("Joan"); EN_FIRST_LIST.add("Pad"); EN_FIRST_LIST.add("Bu"); EN_FIRST_LIST.add("Hearst"); EN_FIRST_LIST.add("Wol"); EN_FIRST_LIST.add("Reg"); EN_FIRST_LIST.add("Woo"); EN_FIRST_LIST.add("By"); EN_FIRST_LIST.add("Pag"); EN_FIRST_LIST.add("Tim"); EN_FIRST_LIST.add("Pal"); EN_FIRST_LIST.add("Crich"); EN_FIRST_LIST.add("Todd"); EN_FIRST_LIST.add("Pan"); EN_FIRST_LIST.add("Cha"); EN_FIRST_LIST.add("Sibyl"); EN_FIRST_LIST.add("Ca"); EN_FIRST_LIST.add("Bing"); EN_FIRST_LIST.add("Par"); EN_FIRST_LIST.add("Yves"); EN_FIRST_LIST.add("Bran"); EN_FIRST_LIST.add("Ce"); EN_FIRST_LIST.add("Ade"); EN_FIRST_LIST.add("Rex"); EN_FIRST_LIST.add("Pau"); EN_FIRST_LIST.add("Rey"); EN_FIRST_LIST.add("Pay"); EN_FIRST_LIST.add("Co"); EN_FIRST_LIST.add("Brad"); EN_FIRST_LIST.add("Sha"); EN_FIRST_LIST.add("Stone"); EN_FIRST_LIST.add("She"); EN_FIRST_LIST.add("Need"); EN_FIRST_LIST.add("Cu"); EN_FIRST_LIST.add("Cy"); EN_FIRST_LIST.add("Tess"); EN_FIRST_LIST.add("North"); EN_FIRST_LIST.add("Da"); EN_FIRST_LIST.add("Christ"); EN_FIRST_LIST.add("Frances"); EN_FIRST_LIST.add("De"); EN_FIRST_LIST.add("Gold"); EN_FIRST_LIST.add("Di"); EN_FIRST_LIST.add("Oisen"); EN_FIRST_LIST.add("Do"); EN_FIRST_LIST.add("Cis"); EN_FIRST_LIST.add("Fox"); EN_FIRST_LIST.add("Dean"); EN_FIRST_LIST.add("Fow"); EN_FIRST_LIST.add("Sid"); EN_FIRST_LIST.add("Sig"); EN_FIRST_LIST.add("Brooke"); EN_FIRST_LIST.add("Du"); EN_FIRST_LIST.add("Dy"); EN_FIRST_LIST.add("Samp"); EN_FIRST_LIST.add("Gra"); EN_FIRST_LIST.add("Sin"); EN_FIRST_LIST.add("Gre"); EN_FIRST_LIST.add("Smed"); EN_FIRST_LIST.add("Ed"); EN_FIRST_LIST.add("Gri"); EN_FIRST_LIST.add("Ef"); EN_FIRST_LIST.add("Eg"); EN_FIRST_LIST.add("Ei"); EN_FIRST_LIST.add("Gro"); EN_FIRST_LIST.add("O'Con"); EN_FIRST_LIST.add("Bird"); EN_FIRST_LIST.add("El"); EN_FIRST_LIST.add("Em"); EN_FIRST_LIST.add("Fors"); EN_FIRST_LIST.add("Er"); EN_FIRST_LIST.add("Holt"); EN_FIRST_LIST.add("Es"); EN_FIRST_LIST.add("Woolf"); EN_FIRST_LIST.add("Eu"); EN_FIRST_LIST.add("Field"); EN_FIRST_LIST.add("Kris"); EN_FIRST_LIST.add("Hub"); EN_FIRST_LIST.add("Hud"); EN_FIRST_LIST.add("Crai"); EN_FIRST_LIST.add("Rho"); EN_FIRST_LIST.add("Boyce"); EN_FIRST_LIST.add("Fa"); EN_FIRST_LIST.add("Hug"); EN_FIRST_LIST.add("Hul"); EN_FIRST_LIST.add("Fe"); EN_FIRST_LIST.add("Hun"); EN_FIRST_LIST.add("Lynch"); EN_FIRST_LIST.add("Grant"); EN_FIRST_LIST.add("Hum"); EN_FIRST_LIST.add("Young"); EN_FIRST_LIST.add("Kent"); EN_FIRST_LIST.add("Bil"); EN_FIRST_LIST.add("Fo"); EN_FIRST_LIST.add("Bir"); EN_FIRST_LIST.add("Hux"); EN_FIRST_LIST.add("Pea"); EN_FIRST_LIST.add("Joel"); EN_FIRST_LIST.add("Peg"); EN_FIRST_LIST.add("White"); EN_FIRST_LIST.add("Fre"); EN_FIRST_LIST.add("Pen"); EN_FIRST_LIST.add("Cla"); EN_FIRST_LIST.add("Ga"); EN_FIRST_LIST.add("Ford"); EN_FIRST_LIST.add("Nan"); EN_FIRST_LIST.add("Per"); EN_FIRST_LIST.add("Cle"); EN_FIRST_LIST.add("Ge"); EN_FIRST_LIST.add("Pet"); EN_FIRST_LIST.add("Nat"); EN_FIRST_LIST.add("John"); EN_FIRST_LIST.add("Crane"); EN_FIRST_LIST.add("Cly"); EN_FIRST_LIST.add("Ode"); EN_FIRST_LIST.add("Browne"); EN_FIRST_LIST.add("Dob"); EN_FIRST_LIST.add("Back"); EN_FIRST_LIST.add("Kerr"); EN_FIRST_LIST.add("Ha"); EN_FIRST_LIST.add("Bach"); EN_FIRST_LIST.add("He"); EN_FIRST_LIST.add("Phil"); EN_FIRST_LIST.add("Hood"); EN_FIRST_LIST.add("Neil"); EN_FIRST_LIST.add("Ever"); EN_FIRST_LIST.add("Dol"); EN_FIRST_LIST.add("Hi"); EN_FIRST_LIST.add("Gun"); EN_FIRST_LIST.add("Don"); EN_FIRST_LIST.add("Pear"); EN_FIRST_LIST.add("Gus"); EN_FIRST_LIST.add("Ho"); EN_FIRST_LIST.add("Guy"); EN_FIRST_LIST.add("Dou"); EN_FIRST_LIST.add("Hu"); EN_FIRST_LIST.add("Mac"); EN_FIRST_LIST.add("Troy"); EN_FIRST_LIST.add("Mab"); EN_FIRST_LIST.add("Doy"); EN_FIRST_LIST.add("Hy"); EN_FIRST_LIST.add("Mag"); EN_FIRST_LIST.add("Tom"); EN_FIRST_LIST.add("Morse"); EN_FIRST_LIST.add("Bla"); EN_FIRST_LIST.add("Mal"); EN_FIRST_LIST.add("Hart"); EN_FIRST_LIST.add("Swift"); EN_FIRST_LIST.add("Man"); EN_FIRST_LIST.add("Bell"); EN_FIRST_LIST.add("Mar"); EN_FIRST_LIST.add("Mau"); EN_FIRST_LIST.add("Wilde"); EN_FIRST_LIST.add("Mat"); EN_FIRST_LIST.add("May"); EN_FIRST_LIST.add("In"); EN_FIRST_LIST.add("Max"); EN_FIRST_LIST.add("Ir"); EN_FIRST_LIST.add("Shaw"); EN_FIRST_LIST.add("Beard"); EN_FIRST_LIST.add("Bly"); EN_FIRST_LIST.add("Phi"); EN_FIRST_LIST.add("Ja"); EN_FIRST_LIST.add("Je"); EN_FIRST_LIST.add("Cof"); EN_FIRST_LIST.add("Wyatt"); EN_FIRST_LIST.add("Com"); EN_FIRST_LIST.add("Col"); EN_FIRST_LIST.add("Coo"); EN_FIRST_LIST.add("Con"); EN_FIRST_LIST.add("James"); EN_FIRST_LIST.add("Jo"); EN_FIRST_LIST.add("Cop"); EN_FIRST_LIST.add("Cor"); EN_FIRST_LIST.add("Cot"); EN_FIRST_LIST.add("Cow"); EN_FIRST_LIST.add("Ju"); EN_FIRST_LIST.add("Croft"); EN_FIRST_LIST.add("Jane"); EN_FIRST_LIST.add("Son"); EN_FIRST_LIST.add("Nel"); EN_FIRST_LIST.add("Ka"); EN_FIRST_LIST.add("Lan"); EN_FIRST_LIST.add("Sou"); EN_FIRST_LIST.add("Lam"); EN_FIRST_LIST.add("Pit"); EN_FIRST_LIST.add("Ke"); EN_FIRST_LIST.add("Lar"); EN_FIRST_LIST.add("Frank"); EN_FIRST_LIST.add("Lat"); EN_FIRST_LIST.add("New"); EN_FIRST_LIST.add("Lau"); EN_FIRST_LIST.add("Horn"); EN_FIRST_LIST.add("Tra"); EN_FIRST_LIST.add("Law"); EN_FIRST_LIST.add("Snow"); EN_FIRST_LIST.add("Tre"); EN_FIRST_LIST.add("Als"); EN_FIRST_LIST.add("Dry"); EN_FIRST_LIST.add("Bob"); EN_FIRST_LIST.add("Stowe"); EN_FIRST_LIST.add("Brid"); EN_FIRST_LIST.add("Chris"); EN_FIRST_LIST.add("Tru"); EN_FIRST_LIST.add("Thodore"); EN_FIRST_LIST.add("Tate"); EN_FIRST_LIST.add("Le"); EN_FIRST_LIST.add("Gwen"); EN_FIRST_LIST.add("Li"); EN_FIRST_LIST.add("Yule"); EN_FIRST_LIST.add("Bon"); EN_FIRST_LIST.add("Alick"); EN_FIRST_LIST.add("Saul"); EN_FIRST_LIST.add("Lo"); EN_FIRST_LIST.add("Rob"); EN_FIRST_LIST.add("Rod"); EN_FIRST_LIST.add("Bos"); EN_FIRST_LIST.add("Lu"); EN_FIRST_LIST.add("Deir"); EN_FIRST_LIST.add("Bow"); EN_FIRST_LIST.add("Ly"); EN_FIRST_LIST.add("Meg"); EN_FIRST_LIST.add("Vogt"); EN_FIRST_LIST.add("Ron"); EN_FIRST_LIST.add("Browning"); EN_FIRST_LIST.add("Nell"); EN_FIRST_LIST.add("Roo"); EN_FIRST_LIST.add("Ma"); EN_FIRST_LIST.add("Mel"); EN_FIRST_LIST.add("Broad"); EN_FIRST_LIST.add("Price"); EN_FIRST_LIST.add("Eve"); EN_FIRST_LIST.add("Jeames"); EN_FIRST_LIST.add("Mc"); EN_FIRST_LIST.add("Ros"); EN_FIRST_LIST.add("Me"); EN_FIRST_LIST.add("Mer"); EN_FIRST_LIST.add("Mi"); EN_FIRST_LIST.add("Wells"); EN_FIRST_LIST.add("Roy"); EN_FIRST_LIST.add("Kat"); EN_FIRST_LIST.add("Ann"); EN_FIRST_LIST.add("Drew"); EN_FIRST_LIST.add("Walk"); EN_FIRST_LIST.add("Giles"); EN_FIRST_LIST.add("Cro"); EN_FIRST_LIST.add("Mo"); EN_FIRST_LIST.add("Finn"); EN_FIRST_LIST.add("Quee"); EN_FIRST_LIST.add("Chur"); EN_FIRST_LIST.add("Kay"); EN_FIRST_LIST.add("Sher"); EN_FIRST_LIST.add("Berg"); EN_FIRST_LIST.add("Mu"); EN_FIRST_LIST.add("Cry"); EN_FIRST_LIST.add("Phoe"); EN_FIRST_LIST.add("Quen"); EN_FIRST_LIST.add("My"); EN_FIRST_LIST.add("Lamb"); EN_FIRST_LIST.add("Na"); EN_FIRST_LIST.add("Maltz"); EN_FIRST_LIST.add("Ne"); EN_FIRST_LIST.add("Dul"); EN_FIRST_LIST.add("Ni"); EN_FIRST_LIST.add("Glenn"); EN_FIRST_LIST.add("Dun"); EN_FIRST_LIST.add("Reade"); EN_FIRST_LIST.add("No"); EN_FIRST_LIST.add("Eips"); EN_FIRST_LIST.add("Lea"); EN_FIRST_LIST.add("Ny"); EN_FIRST_LIST.add("Duke"); EN_FIRST_LIST.add("Noah"); EN_FIRST_LIST.add("Lee"); EN_FIRST_LIST.add("Jac"); EN_FIRST_LIST.add("Bra"); EN_FIRST_LIST.add("Tur"); EN_FIRST_LIST.add("Faulk"); EN_FIRST_LIST.add("Lei"); EN_FIRST_LIST.add("Tut"); EN_FIRST_LIST.add("Len"); EN_FIRST_LIST.add("Oc"); EN_FIRST_LIST.add("Yvon"); EN_FIRST_LIST.add("Jan"); EN_FIRST_LIST.add("Leo"); EN_FIRST_LIST.add("Og"); EN_FIRST_LIST.add("Bert"); EN_FIRST_LIST.add("Les"); EN_FIRST_LIST.add("Shel"); EN_FIRST_LIST.add("Ol"); EN_FIRST_LIST.add("Shei"); EN_FIRST_LIST.add("Bro"); EN_FIRST_LIST.add("Lew"); EN_FIRST_LIST.add("Sta"); EN_FIRST_LIST.add("Jay"); EN_FIRST_LIST.add("Or"); EN_FIRST_LIST.add("Troll"); EN_FIRST_LIST.add("Os"); EN_FIRST_LIST.add("Bru"); EN_FIRST_LIST.add("Ralph"); EN_FIRST_LIST.add("Ste"); EN_FIRST_LIST.add("Ot"); EN_FIRST_LIST.add("Bald"); EN_FIRST_LIST.add("Blan"); EN_FIRST_LIST.add("Bry"); EN_FIRST_LIST.add("Pa"); EN_FIRST_LIST.add("Dunn"); EN_FIRST_LIST.add("Reed"); EN_FIRST_LIST.add("Pe"); EN_FIRST_LIST.add("Bush"); EN_FIRST_LIST.add("Theo"); EN_FIRST_LIST.add("Sweet"); EN_FIRST_LIST.add("Cooke"); EN_FIRST_LIST.add("Pi"); EN_FIRST_LIST.add("Cum"); EN_FIRST_LIST.add("Bess"); EN_FIRST_LIST.add("Po"); EN_FIRST_LIST.add("Cur"); EN_FIRST_LIST.add("Keith"); EN_FIRST_LIST.add("Cliff"); EN_FIRST_LIST.add("Gill"); EN_FIRST_LIST.add("Demp"); EN_FIRST_LIST.add("Pu"); EN_FIRST_LIST.add("Hous"); EN_FIRST_LIST.add("Poe"); EN_FIRST_LIST.add("Mid"); EN_FIRST_LIST.add("Mig"); EN_FIRST_LIST.add("Grote"); EN_FIRST_LIST.add("Spring"); EN_FIRST_LIST.add("Pol"); EN_FIRST_LIST.add("Abra"); EN_FIRST_LIST.add("Pop"); EN_FIRST_LIST.add("Mil"); EN_FIRST_LIST.add("Ara"); EN_FIRST_LIST.add("Sur"); EN_FIRST_LIST.add("Por"); EN_FIRST_LIST.add("Kel"); EN_FIRST_LIST.add("Min"); EN_FIRST_LIST.add("Ken"); EN_FIRST_LIST.add("Kep"); EN_FIRST_LIST.add("Bloom"); EN_FIRST_LIST.add("Ian"); EN_FIRST_LIST.add("Faithe"); EN_FIRST_LIST.add("Sean"); EN_FIRST_LIST.add("Fran"); EN_FIRST_LIST.add("Ker"); EN_FIRST_LIST.add("Bloor"); EN_FIRST_LIST.add("Sails"); EN_FIRST_LIST.add("Wheat"); EN_FIRST_LIST.add("Arm"); EN_FIRST_LIST.add("Key"); EN_FIRST_LIST.add("Quil"); EN_FIRST_LIST.add("Pull"); EN_FIRST_LIST.add("Hill"); EN_FIRST_LIST.add("Stan"); EN_FIRST_LIST.add("Kath"); EN_FIRST_LIST.add("Dodd"); EN_FIRST_LIST.add("Ra"); EN_FIRST_LIST.add("Quin"); EN_FIRST_LIST.add("Lionel"); EN_FIRST_LIST.add("Bron"); EN_FIRST_LIST.add("Jones"); EN_FIRST_LIST.add("Re"); EN_FIRST_LIST.add("Ri"); EN_FIRST_LIST.add("Bul"); EN_FIRST_LIST.add("Josh"); EN_FIRST_LIST.add("Clar"); EN_FIRST_LIST.add("Bun"); EN_FIRST_LIST.add("Wolf"); EN_FIRST_LIST.add("Ro"); EN_FIRST_LIST.add("Mans"); EN_FIRST_LIST.add("Tout"); EN_FIRST_LIST.add("Bur"); EN_FIRST_LIST.add("But"); EN_FIRST_LIST.add("Ru"); EN_FIRST_LIST.add("Ry"); EN_FIRST_LIST.add("Jef"); EN_FIRST_LIST.add("Noel"); EN_FIRST_LIST.add("Sa"); EN_FIRST_LIST.add("Lil"); EN_FIRST_LIST.add("Hag"); EN_FIRST_LIST.add("Lin"); EN_FIRST_LIST.add("Rus"); EN_FIRST_LIST.add("Se"); EN_FIRST_LIST.add("Hal"); EN_FIRST_LIST.add("Jen"); EN_FIRST_LIST.add("Han"); EN_FIRST_LIST.add("Ham"); EN_FIRST_LIST.add("Si"); EN_FIRST_LIST.add("Jer"); EN_FIRST_LIST.add("Har"); EN_FIRST_LIST.add("Shir"); EN_FIRST_LIST.add("Jes"); EN_FIRST_LIST.add("So"); EN_FIRST_LIST.add("Liz"); EN_FIRST_LIST.add("Scott"); EN_FIRST_LIST.add("Sains"); EN_FIRST_LIST.add("Haw"); EN_FIRST_LIST.add("Att"); EN_FIRST_LIST.add("Haz"); EN_FIRST_LIST.add("Hay"); EN_FIRST_LIST.add("Su"); EN_FIRST_LIST.add("Xan"); EN_FIRST_LIST.add("Sy"); EN_FIRST_LIST.add("Pri"); EN_FIRST_LIST.add("Yale"); EN_FIRST_LIST.add("Fitz"); EN_FIRST_LIST.add("Crom"); EN_FIRST_LIST.add("Strong"); EN_FIRST_LIST.add("Ta"); EN_FIRST_LIST.add("Harte"); EN_FIRST_LIST.add("Swin"); EN_FIRST_LIST.add("Leigh"); EN_FIRST_LIST.add("Yvette"); EN_FIRST_LIST.add("Te"); EN_FIRST_LIST.add("Pru"); EN_FIRST_LIST.add("Ti"); EN_FIRST_LIST.add("Ives"); EN_FIRST_LIST.add("Cyn"); EN_FIRST_LIST.add("To"); EN_FIRST_LIST.add("Aus"); EN_FIRST_LIST.add("Gray"); EN_FIRST_LIST.add("Ty"); EN_FIRST_LIST.add("Syl"); EN_FIRST_LIST.add("Wylde"); EN_FIRST_LIST.add("Fred"); EN_FIRST_LIST.add("Yonng"); EN_FIRST_LIST.add("Free"); EN_FIRST_LIST.add("Kim"); EN_FIRST_LIST.add("Nor"); EN_FIRST_LIST.add("Miles"); EN_FIRST_LIST.add("Penn"); EN_FIRST_LIST.add("Gal"); EN_FIRST_LIST.add("Kip"); EN_FIRST_LIST.add("Yea"); EN_FIRST_LIST.add("Ward"); EN_FIRST_LIST.add("Vaug"); EN_FIRST_LIST.add("Keats"); EN_FIRST_LIST.add("Kit"); EN_FIRST_LIST.add("Long"); EN_FIRST_LIST.add("Gas"); EN_FIRST_LIST.add("Gar"); EN_FIRST_LIST.add("Yed"); EN_FIRST_LIST.add("Up"); EN_FIRST_LIST.add("Wag"); EN_FIRST_LIST.add("Holmes"); EN_FIRST_LIST.add("Ur"); EN_FIRST_LIST.add("Camp"); EN_FIRST_LIST.add("Simp"); EN_FIRST_LIST.add("Brown"); EN_FIRST_LIST.add("Wal"); EN_FIRST_LIST.add("Watt"); EN_FIRST_LIST.add("Wan"); EN_FIRST_LIST.add("Yer"); EN_FIRST_LIST.add("Wright"); EN_FIRST_LIST.add("Yet"); EN_FIRST_LIST.add("Mark"); EN_FIRST_LIST.add("Clare"); EN_FIRST_LIST.add("War"); EN_FIRST_LIST.add("Va"); EN_FIRST_LIST.add("Wat"); EN_FIRST_LIST.add("Greg"); EN_FIRST_LIST.add("Funk"); EN_FIRST_LIST.add("Bard"); EN_FIRST_LIST.add("Way"); EN_FIRST_LIST.add("Stel"); EN_FIRST_LIST.add("Camil"); EN_FIRST_LIST.add("Ve"); EN_FIRST_LIST.add("Dutt"); EN_FIRST_LIST.add("Clark"); EN_FIRST_LIST.add("Vi"); EN_FIRST_LIST.add("Toyn"); EN_FIRST_LIST.add("Mond"); EN_FIRST_LIST.add("Grey"); EN_FIRST_LIST.add("Wood"); EN_FIRST_LIST.add("Moi"); EN_FIRST_LIST.add("Hed"); EN_FIRST_LIST.add("Pul"); EN_FIRST_LIST.add("Moll"); EN_FIRST_LIST.add("Wa"); EN_FIRST_LIST.add("Jean"); EN_FIRST_LIST.add("Mol"); EN_FIRST_LIST.add("Moo"); EN_FIRST_LIST.add("Hugh"); EN_FIRST_LIST.add("Mon"); EN_FIRST_LIST.add("Stein"); EN_FIRST_LIST.add("Jim"); EN_FIRST_LIST.add("Hen"); EN_FIRST_LIST.add("Bruce"); EN_FIRST_LIST.add("Mor"); EN_FIRST_LIST.add("Wh"); EN_FIRST_LIST.add("Fan"); EN_FIRST_LIST.add("Wi"); EN_FIRST_LIST.add("Mot"); EN_FIRST_LIST.add("Her"); EN_FIRST_LIST.add("Pound"); EN_FIRST_LIST.add("Wo"); EN_FIRST_LIST.add("Hew"); EN_FIRST_LIST.add("Wool"); EN_FIRST_LIST.add("Green"); EN_FIRST_LIST.add("Bart"); EN_FIRST_LIST.add("Fay"); EN_FIRST_LIST.add("Zim"); EN_FIRST_LIST.add("Mick"); EN_FIRST_LIST.add("Wy"); EN_FIRST_LIST.add("Van"); EN_FIRST_LIST.add("Word"); EN_FIRST_LIST.add("Thorn"); EN_FIRST_LIST.add("Sharp"); EN_FIRST_LIST.add("Judd"); EN_FIRST_LIST.add("Xa"); EN_FIRST_LIST.add("Xe"); EN_FIRST_LIST.add("Phyl"); EN_FIRST_LIST.add("Matt"); EN_FIRST_LIST.add("Twain"); EN_FIRST_LIST.add("Gene"); EN_FIRST_LIST.add("Dwight"); EN_FIRST_LIST.add("Child"); EN_FIRST_LIST.add("Carr"); EN_FIRST_LIST.add("Carl"); EN_FIRST_LIST.add("Smith"); EN_FIRST_LIST.add("House"); EN_FIRST_LIST.add("Lon"); EN_FIRST_LIST.add("Ye"); EN_FIRST_LIST.add("Mont"); EN_FIRST_LIST.add("Gem"); EN_FIRST_LIST.add("Lor"); EN_FIRST_LIST.add("Lou"); EN_FIRST_LIST.add("Ear"); EN_FIRST_LIST.add("Jill"); EN_FIRST_LIST.add("Geor"); EN_FIRST_LIST.add("Wen"); EN_FIRST_LIST.add("Stil"); EN_FIRST_LIST.add("Wes"); EN_FIRST_LIST.add("Wer"); EN_FIRST_LIST.add("Za"); EN_FIRST_LIST.add("Cook"); EN_FIRST_LIST.add("Chad"); EN_FIRST_LIST.add("Cleve"); EN_FIRST_LIST.add("Grif"); EN_FIRST_LIST.add("Ze"); EN_FIRST_LIST.add("Cash"); EN_FIRST_LIST.add("Cham"); EN_FIRST_LIST.add("Joyce"); EN_FIRST_LIST.add("More"); EN_FIRST_LIST.add("Chan"); EN_FIRST_LIST.add("Loui"); EN_FIRST_LIST.add("Chap"); EN_FIRST_LIST.add("Thom"); EN_FIRST_LIST.add("Zo"); EN_FIRST_LIST.add("Char"); EN_FIRST_LIST.add("Chau"); EN_FIRST_LIST.add("Maug"); EN_FIRST_LIST.add("Priest"); EN_FIRST_LIST.add("Maud"); EN_FIRST_LIST.add("Zang"); EN_FIRST_LIST.add("Crofts"); EN_FIRST_LIST.add("Hil"); EN_FIRST_LIST.add("Fel"); EN_FIRST_LIST.add("Dai"); EN_FIRST_LIST.add("Dal"); EN_FIRST_LIST.add("Dan"); EN_FIRST_LIST.add("Cons"); EN_FIRST_LIST.add("Veb"); EN_FIRST_LIST.add("Fer"); EN_FIRST_LIST.add("Dar"); EN_FIRST_LIST.add("Geof"); EN_FIRST_LIST.add("Blair"); EN_FIRST_LIST.add("Tab"); EN_FIRST_LIST.add("Jeff"); EN_FIRST_LIST.add("Whee"); EN_FIRST_LIST.add("Wilhel"); EN_FIRST_LIST.add("Chloe"); EN_FIRST_LIST.add("Borg"); EN_FIRST_LIST.add("Tam"); EN_FIRST_LIST.add("Ver"); EN_FIRST_LIST.add("Grace"); EN_FIRST_LIST.add("Webb"); EN_FIRST_LIST.add("Quinn"); EN_FIRST_LIST.add("Tay"); EN_FIRST_LIST.add("Burne"); EN_FIRST_LIST.add("King"); EN_FIRST_LIST.add("Webs"); EN_FIRST_LIST.add("Job"); EN_FIRST_LIST.add("Roxan"); EN_FIRST_LIST.add("Joe"); EN_FIRST_LIST.add("Gib"); EN_FIRST_LIST.add("Kyle"); EN_FIRST_LIST.add("Cae"); EN_FIRST_LIST.add("Nick"); EN_FIRST_LIST.add("Hume"); EN_FIRST_LIST.add("Jon"); EN_FIRST_LIST.add("Mur"); EN_FIRST_LIST.add("Gil"); EN_FIRST_LIST.add("Jor"); EN_FIRST_LIST.add("Louie"); EN_FIRST_LIST.add("Cal"); EN_FIRST_LIST.add("Gis"); EN_FIRST_LIST.add("Jou"); EN_FIRST_LIST.add("Can"); EN_FIRST_LIST.add("Zoe"); EN_FIRST_LIST.add("Car"); EN_FIRST_LIST.add("Joy"); EN_FIRST_LIST.add("Wil"); EN_FIRST_LIST.add("Burns"); EN_FIRST_LIST.add("Gail"); EN_FIRST_LIST.add("Win"); EN_FIRST_LIST.add("Sam"); EN_FIRST_LIST.add("Sal"); EN_FIRST_LIST.add("Louis"); EN_FIRST_LIST.add("Spen"); EN_FIRST_LIST.add("San"); EN_FIRST_LIST.add("Wild"); EN_FIRST_LIST.add("Sas"); EN_FIRST_LIST.add("York"); EN_FIRST_LIST.add("Lance"); EN_FIRST_LIST.add("Beau"); EN_FIRST_LIST.add("Saw"); EN_FIRST_LIST.add("Hodg"); EN_FIRST_LIST.add("Glad"); EN_FIRST_LIST.add("Claude"); EN_FIRST_LIST.add("Sax"); EN_FIRST_LIST.add("Brook"); EN_FIRST_LIST.add("Kings"); EN_FIRST_LIST.add("Cher"); EN_FIRST_LIST.add("Gale"); EN_FIRST_LIST.add("Ches"); EN_FIRST_LIST.add("Rhys"); EN_FIRST_LIST.add("Earl"); EN_FIRST_LIST.add("Will"); EN_FIRST_LIST.add("Pritt"); EN_FIRST_LIST.add("Rusk"); EN_FIRST_LIST.add("Jack"); EN_FIRST_LIST.add("Deb"); EN_FIRST_LIST.add("Bab"); EN_FIRST_LIST.add("Flower"); EN_FIRST_LIST.add("Fin"); EN_FIRST_LIST.add("O'Neil"); EN_FIRST_LIST.add("Den"); EN_FIRST_LIST.add("Dick"); EN_FIRST_LIST.add("Thomp"); EN_FIRST_LIST.add("Der"); EN_FIRST_LIST.add("Vic"); EN_FIRST_LIST.add("Bar"); EN_FIRST_LIST.add("Ted"); EN_FIRST_LIST.add("Boyle"); EN_FIRST_LIST.add("Stuart"); EN_FIRST_LIST.add("Whit"); EN_FIRST_LIST.add("Bau"); EN_FIRST_LIST.add("Rae"); EN_FIRST_LIST.add("Blume"); EN_FIRST_LIST.add("Vin"); EN_FIRST_LIST.add("Bryce"); EN_FIRST_LIST.add("Ten"); EN_FIRST_LIST.add("Gla"); EN_FIRST_LIST.add("Vio"); EN_FIRST_LIST.add("Moul"); EN_FIRST_LIST.add("Tem"); EN_FIRST_LIST.add("Vir"); EN_FIRST_LIST.add("Ran"); } public static void initEN_LAST_LIST() { EN_LAST_LIST.add("nings"); EN_LAST_LIST.add("hale"); EN_LAST_LIST.add("lvis"); EN_LAST_LIST.add("hall"); EN_LAST_LIST.add("todd"); EN_LAST_LIST.add("via"); EN_LAST_LIST.add("vid"); EN_LAST_LIST.add("liot"); EN_LAST_LIST.add("vic"); EN_LAST_LIST.add("ted"); EN_LAST_LIST.add("rad"); EN_LAST_LIST.add("rae"); EN_LAST_LIST.add("rah"); EN_LAST_LIST.add("vin"); EN_LAST_LIST.add("ral"); EN_LAST_LIST.add("ten"); EN_LAST_LIST.add("ram"); EN_LAST_LIST.add("ter"); EN_LAST_LIST.add("vis"); EN_LAST_LIST.add("tes"); EN_LAST_LIST.add("thus"); EN_LAST_LIST.add("thur"); EN_LAST_LIST.add("ray"); EN_LAST_LIST.add("lins"); EN_LAST_LIST.add("pont"); EN_LAST_LIST.add("dawn"); EN_LAST_LIST.add("glenn"); EN_LAST_LIST.add("kuk"); EN_LAST_LIST.add("rold"); EN_LAST_LIST.add("cliff"); EN_LAST_LIST.add("roll"); EN_LAST_LIST.add("gold"); EN_LAST_LIST.add("cer"); EN_LAST_LIST.add("xon"); EN_LAST_LIST.add("cey"); EN_LAST_LIST.add("browne"); EN_LAST_LIST.add("scott"); EN_LAST_LIST.add("a"); EN_LAST_LIST.add("rwood"); EN_LAST_LIST.add("leif"); EN_LAST_LIST.add("h"); EN_LAST_LIST.add("tha"); EN_LAST_LIST.add("n"); EN_LAST_LIST.add("o"); EN_LAST_LIST.add("the"); EN_LAST_LIST.add("fast"); EN_LAST_LIST.add("frances"); EN_LAST_LIST.add("y"); EN_LAST_LIST.add("clife"); EN_LAST_LIST.add("sweet"); EN_LAST_LIST.add("muel"); EN_LAST_LIST.add("rone"); EN_LAST_LIST.add("lith"); EN_LAST_LIST.add("thy"); EN_LAST_LIST.add("ning"); EN_LAST_LIST.add("chill"); EN_LAST_LIST.add("gou"); EN_LAST_LIST.add("tia"); EN_LAST_LIST.add("litt"); EN_LAST_LIST.add("red"); EN_LAST_LIST.add("thorne"); EN_LAST_LIST.add("tie"); EN_LAST_LIST.add("rian"); EN_LAST_LIST.add("reg"); EN_LAST_LIST.add("riam"); EN_LAST_LIST.add("pag"); EN_LAST_LIST.add("tin"); EN_LAST_LIST.add("rel"); EN_LAST_LIST.add("tim"); EN_LAST_LIST.add("ren"); EN_LAST_LIST.add("tio"); EN_LAST_LIST.add("rias"); EN_LAST_LIST.add("swift"); EN_LAST_LIST.add("tis"); EN_LAST_LIST.add("ret"); EN_LAST_LIST.add("che"); EN_LAST_LIST.add("res"); EN_LAST_LIST.add("rex"); EN_LAST_LIST.add("chi"); EN_LAST_LIST.add("lace"); EN_LAST_LIST.add("rey"); EN_LAST_LIST.add("riah"); EN_LAST_LIST.add("holmes"); EN_LAST_LIST.add("phine"); EN_LAST_LIST.add("yves"); EN_LAST_LIST.add("cia"); EN_LAST_LIST.add("cie"); EN_LAST_LIST.add("child"); EN_LAST_LIST.add("young"); EN_LAST_LIST.add("cil"); EN_LAST_LIST.add("hart"); EN_LAST_LIST.add("cis"); EN_LAST_LIST.add("miles"); EN_LAST_LIST.add("ridge"); EN_LAST_LIST.add("bruce"); EN_LAST_LIST.add("live"); EN_LAST_LIST.add("lius"); EN_LAST_LIST.add("rick"); EN_LAST_LIST.add("tle"); EN_LAST_LIST.add("nior"); EN_LAST_LIST.add("crofts"); EN_LAST_LIST.add("well"); EN_LAST_LIST.add("cke"); EN_LAST_LIST.add("sworth"); EN_LAST_LIST.add("ria"); EN_LAST_LIST.add("rid"); EN_LAST_LIST.add("ric"); EN_LAST_LIST.add("wylde"); EN_LAST_LIST.add("rie"); EN_LAST_LIST.add("cky"); EN_LAST_LIST.add("ries"); EN_LAST_LIST.add("peg"); EN_LAST_LIST.add("riet"); EN_LAST_LIST.add("nah"); EN_LAST_LIST.add("ril"); EN_LAST_LIST.add("keats"); EN_LAST_LIST.add("pel"); EN_LAST_LIST.add("rin"); EN_LAST_LIST.add("nal"); EN_LAST_LIST.add("nan"); EN_LAST_LIST.add("per"); EN_LAST_LIST.add("ris"); EN_LAST_LIST.add("jane"); EN_LAST_LIST.add("nat"); EN_LAST_LIST.add("nas"); EN_LAST_LIST.add("raine"); EN_LAST_LIST.add("neil"); EN_LAST_LIST.add("quinn"); EN_LAST_LIST.add("riel"); EN_LAST_LIST.add("faithe"); EN_LAST_LIST.add("gue"); EN_LAST_LIST.add("braith"); EN_LAST_LIST.add("gus"); EN_LAST_LIST.add("nell"); EN_LAST_LIST.add("guy"); EN_LAST_LIST.add("saul"); EN_LAST_LIST.add("vogt"); EN_LAST_LIST.add("ton"); EN_LAST_LIST.add("tom"); EN_LAST_LIST.add("tance"); EN_LAST_LIST.add("tian"); EN_LAST_LIST.add("tor"); EN_LAST_LIST.add("lain"); EN_LAST_LIST.add("mund"); EN_LAST_LIST.add("sharp"); EN_LAST_LIST.add("sham"); EN_LAST_LIST.add("cob"); EN_LAST_LIST.add("twain"); EN_LAST_LIST.add("shaw"); EN_LAST_LIST.add("nise"); EN_LAST_LIST.add("phy"); EN_LAST_LIST.add("col"); EN_LAST_LIST.add("con"); EN_LAST_LIST.add("duke"); EN_LAST_LIST.add("cent"); EN_LAST_LIST.add("phael"); EN_LAST_LIST.add("lett"); EN_LAST_LIST.add("cox"); EN_LAST_LIST.add("nee"); EN_LAST_LIST.add("reau"); EN_LAST_LIST.add("nel"); EN_LAST_LIST.add("lan"); EN_LAST_LIST.add("pir"); EN_LAST_LIST.add("ner"); EN_LAST_LIST.add("lap"); EN_LAST_LIST.add("ale"); EN_LAST_LIST.add("net"); EN_LAST_LIST.add("nes"); EN_LAST_LIST.add("las"); EN_LAST_LIST.add("tra"); EN_LAST_LIST.add("law"); EN_LAST_LIST.add("ney"); EN_LAST_LIST.add("lay"); EN_LAST_LIST.add("shall"); EN_LAST_LIST.add("phens"); EN_LAST_LIST.add("cius"); EN_LAST_LIST.add("snow"); EN_LAST_LIST.add("rob"); EN_LAST_LIST.add("rod"); EN_LAST_LIST.add("bush"); EN_LAST_LIST.add("roe"); EN_LAST_LIST.add("trick"); EN_LAST_LIST.add("rol"); EN_LAST_LIST.add("ron"); EN_LAST_LIST.add("bryce"); EN_LAST_LIST.add("gill"); EN_LAST_LIST.add("tier"); EN_LAST_LIST.add("blume"); EN_LAST_LIST.add("trice"); EN_LAST_LIST.add("land"); EN_LAST_LIST.add("roy"); EN_LAST_LIST.add("ann"); EN_LAST_LIST.add("tta"); EN_LAST_LIST.add("ple"); EN_LAST_LIST.add("phrey"); EN_LAST_LIST.add("wald"); EN_LAST_LIST.add("lamb"); EN_LAST_LIST.add("nence"); EN_LAST_LIST.add("nia"); EN_LAST_LIST.add("nid"); EN_LAST_LIST.add("nic"); EN_LAST_LIST.add("nie"); EN_LAST_LIST.add("lee"); EN_LAST_LIST.add("jah"); EN_LAST_LIST.add("nin"); EN_LAST_LIST.add("tus"); EN_LAST_LIST.add("len"); EN_LAST_LIST.add("nio"); EN_LAST_LIST.add("vian"); EN_LAST_LIST.add("gins"); EN_LAST_LIST.add("elroy"); EN_LAST_LIST.add("ler"); EN_LAST_LIST.add("nis"); EN_LAST_LIST.add("bois"); EN_LAST_LIST.add("let"); EN_LAST_LIST.add("les"); EN_LAST_LIST.add("rine"); EN_LAST_LIST.add("nix"); EN_LAST_LIST.add("lew"); EN_LAST_LIST.add("ley"); EN_LAST_LIST.add("jay"); EN_LAST_LIST.add("tosh"); EN_LAST_LIST.add("reed"); EN_LAST_LIST.add("reen"); EN_LAST_LIST.add("baird"); EN_LAST_LIST.add("bohm"); EN_LAST_LIST.add("dunn"); EN_LAST_LIST.add("brooke"); EN_LAST_LIST.add("cus"); EN_LAST_LIST.add("penn"); EN_LAST_LIST.add("nett"); EN_LAST_LIST.add("poe"); EN_LAST_LIST.add("ward"); EN_LAST_LIST.add("worth"); EN_LAST_LIST.add("pkins"); EN_LAST_LIST.add("gray"); EN_LAST_LIST.add("lard"); EN_LAST_LIST.add("grace"); EN_LAST_LIST.add("nald"); EN_LAST_LIST.add("vice"); EN_LAST_LIST.add("rion"); EN_LAST_LIST.add("dodd"); EN_LAST_LIST.add("peare"); EN_LAST_LIST.add("gram"); EN_LAST_LIST.add("yan"); EN_LAST_LIST.add("black"); EN_LAST_LIST.add("nest"); EN_LAST_LIST.add("tout"); EN_LAST_LIST.add("chard"); EN_LAST_LIST.add("smith"); EN_LAST_LIST.add("lia"); EN_LAST_LIST.add("lie"); EN_LAST_LIST.add("lynch"); EN_LAST_LIST.add("lin"); EN_LAST_LIST.add("pril"); EN_LAST_LIST.add("moll"); EN_LAST_LIST.add("hal"); EN_LAST_LIST.add("lip"); EN_LAST_LIST.add("han"); EN_LAST_LIST.add("ham"); EN_LAST_LIST.add("piers"); EN_LAST_LIST.add("lis"); EN_LAST_LIST.add("bias"); EN_LAST_LIST.add("vier"); EN_LAST_LIST.add("bian"); EN_LAST_LIST.add("lix"); EN_LAST_LIST.add("nand"); EN_LAST_LIST.add("liz"); EN_LAST_LIST.add("hugh"); EN_LAST_LIST.add("lass"); EN_LAST_LIST.add("ives"); EN_LAST_LIST.add("vien"); EN_LAST_LIST.add("camp"); EN_LAST_LIST.add("kiel"); EN_LAST_LIST.add("boyce"); EN_LAST_LIST.add("yale"); EN_LAST_LIST.add("shop"); EN_LAST_LIST.add("pert"); EN_LAST_LIST.add("rell"); EN_LAST_LIST.add("non"); EN_LAST_LIST.add("house"); EN_LAST_LIST.add("nor"); EN_LAST_LIST.add("mons"); EN_LAST_LIST.add("tine"); EN_LAST_LIST.add("rite"); EN_LAST_LIST.add("green"); EN_LAST_LIST.add("race"); EN_LAST_LIST.add("yes"); EN_LAST_LIST.add("yer"); EN_LAST_LIST.add("war"); EN_LAST_LIST.add("yet"); EN_LAST_LIST.add("wat"); EN_LAST_LIST.add("mond"); EN_LAST_LIST.add("way"); EN_LAST_LIST.add("grey"); EN_LAST_LIST.add("miah"); EN_LAST_LIST.add("drich"); EN_LAST_LIST.add("funk"); EN_LAST_LIST.add("watt"); EN_LAST_LIST.add("greg"); EN_LAST_LIST.add("dutt"); EN_LAST_LIST.add("ryl"); EN_LAST_LIST.add("croft"); EN_LAST_LIST.add("jim"); EN_LAST_LIST.add("alick"); EN_LAST_LIST.add("nard"); EN_LAST_LIST.add("broad"); EN_LAST_LIST.add("fax"); EN_LAST_LIST.add("tram"); EN_LAST_LIST.add("cash"); EN_LAST_LIST.add("rene"); EN_LAST_LIST.add("fay"); EN_LAST_LIST.add("tion"); EN_LAST_LIST.add("gene"); EN_LAST_LIST.add("harte"); EN_LAST_LIST.add("carr"); EN_LAST_LIST.add("niell"); EN_LAST_LIST.add("mick"); EN_LAST_LIST.add("judd"); EN_LAST_LIST.add("loc"); EN_LAST_LIST.add("diah"); EN_LAST_LIST.add("bright"); EN_LAST_LIST.add("lon"); EN_LAST_LIST.add("dolph"); EN_LAST_LIST.add("lop"); EN_LAST_LIST.add("gail"); EN_LAST_LIST.add("lor"); EN_LAST_LIST.add("lot"); EN_LAST_LIST.add("lou"); EN_LAST_LIST.add("hume"); EN_LAST_LIST.add("low"); EN_LAST_LIST.add("tein"); EN_LAST_LIST.add("wen"); EN_LAST_LIST.add("wer"); EN_LAST_LIST.add("more"); EN_LAST_LIST.add("chad"); EN_LAST_LIST.add("born"); EN_LAST_LIST.add("dolf"); EN_LAST_LIST.add("wey"); EN_LAST_LIST.add("borg"); EN_LAST_LIST.add("grid"); EN_LAST_LIST.add("dick"); EN_LAST_LIST.add("chell"); EN_LAST_LIST.add("dad"); EN_LAST_LIST.add("dice"); EN_LAST_LIST.add("pys"); EN_LAST_LIST.add("whit"); EN_LAST_LIST.add("nus"); EN_LAST_LIST.add("gess"); EN_LAST_LIST.add("dan"); EN_LAST_LIST.add("dam"); EN_LAST_LIST.add("mott"); EN_LAST_LIST.add("kins"); EN_LAST_LIST.add("fer"); EN_LAST_LIST.add("shua"); EN_LAST_LIST.add("beau"); EN_LAST_LIST.add("dict"); EN_LAST_LIST.add("ving"); EN_LAST_LIST.add("fey"); EN_LAST_LIST.add("day"); EN_LAST_LIST.add("bloor"); EN_LAST_LIST.add("bott"); EN_LAST_LIST.add("king"); EN_LAST_LIST.add("grote"); EN_LAST_LIST.add("job"); EN_LAST_LIST.add("joe"); EN_LAST_LIST.add("beck"); EN_LAST_LIST.add("mike"); EN_LAST_LIST.add("rett"); EN_LAST_LIST.add("dore"); EN_LAST_LIST.add("rald"); EN_LAST_LIST.add("joy"); EN_LAST_LIST.add("win"); EN_LAST_LIST.add("sam"); EN_LAST_LIST.add("wis"); EN_LAST_LIST.add("chael"); EN_LAST_LIST.add("san"); EN_LAST_LIST.add("glan"); EN_LAST_LIST.add("chel"); EN_LAST_LIST.add("gale"); EN_LAST_LIST.add("sar"); EN_LAST_LIST.add("glas"); EN_LAST_LIST.add("say"); EN_LAST_LIST.add("maltz"); EN_LAST_LIST.add("lyle"); EN_LAST_LIST.add("chey"); EN_LAST_LIST.add("earl"); EN_LAST_LIST.add("cher"); EN_LAST_LIST.add("fie"); EN_LAST_LIST.add("joan"); EN_LAST_LIST.add("lup"); EN_LAST_LIST.add("del"); EN_LAST_LIST.add("lus"); EN_LAST_LIST.add("den"); EN_LAST_LIST.add("der"); EN_LAST_LIST.add("pham"); EN_LAST_LIST.add("bar"); EN_LAST_LIST.add("des"); EN_LAST_LIST.add("ac"); EN_LAST_LIST.add("giles"); EN_LAST_LIST.add("kirk"); EN_LAST_LIST.add("ah"); EN_LAST_LIST.add("bill"); EN_LAST_LIST.add("leste"); EN_LAST_LIST.add("an"); EN_LAST_LIST.add("trid"); EN_LAST_LIST.add("mill"); EN_LAST_LIST.add("boyd"); EN_LAST_LIST.add("bby"); EN_LAST_LIST.add("jones"); EN_LAST_LIST.add("lynn"); EN_LAST_LIST.add("frank"); EN_LAST_LIST.add("velt"); EN_LAST_LIST.add("dean"); EN_LAST_LIST.add("strong"); EN_LAST_LIST.add("dge"); EN_LAST_LIST.add("be"); EN_LAST_LIST.add("ters"); EN_LAST_LIST.add("rence"); EN_LAST_LIST.add("sea"); EN_LAST_LIST.add("xine"); EN_LAST_LIST.add("laine"); EN_LAST_LIST.add("by"); EN_LAST_LIST.add("sel"); EN_LAST_LIST.add("sen"); EN_LAST_LIST.add("ca"); EN_LAST_LIST.add("ses"); EN_LAST_LIST.add("ser"); EN_LAST_LIST.add("ce"); EN_LAST_LIST.add("bins"); EN_LAST_LIST.add("ch"); EN_LAST_LIST.add("sey"); EN_LAST_LIST.add("ck"); EN_LAST_LIST.add("kell"); EN_LAST_LIST.add("co"); EN_LAST_LIST.add("bing"); EN_LAST_LIST.add("june"); EN_LAST_LIST.add("cy"); EN_LAST_LIST.add("paul"); EN_LAST_LIST.add("hutt"); EN_LAST_LIST.add("da"); EN_LAST_LIST.add("dia"); EN_LAST_LIST.add("lyn"); EN_LAST_LIST.add("die"); EN_LAST_LIST.add("de"); EN_LAST_LIST.add("bee"); EN_LAST_LIST.add("di"); EN_LAST_LIST.add("bel"); EN_LAST_LIST.add("dn"); EN_LAST_LIST.add("ben"); EN_LAST_LIST.add("ford"); EN_LAST_LIST.add("do"); EN_LAST_LIST.add("pher"); EN_LAST_LIST.add("bes"); EN_LAST_LIST.add("claude"); EN_LAST_LIST.add("kent"); EN_LAST_LIST.add("dy"); EN_LAST_LIST.add("phen"); EN_LAST_LIST.add("bey"); EN_LAST_LIST.add("bird"); EN_LAST_LIST.add("joel"); EN_LAST_LIST.add("nuel"); EN_LAST_LIST.add("ed"); EN_LAST_LIST.add("ralph"); EN_LAST_LIST.add("el"); EN_LAST_LIST.add("tess"); EN_LAST_LIST.add("brown"); EN_LAST_LIST.add("er"); EN_LAST_LIST.add("dike"); EN_LAST_LIST.add("chards"); EN_LAST_LIST.add("foe"); EN_LAST_LIST.add("fe"); EN_LAST_LIST.add("back"); EN_LAST_LIST.add("bach"); EN_LAST_LIST.add("sia"); EN_LAST_LIST.add("sie"); EN_LAST_LIST.add("fox"); EN_LAST_LIST.add("sid"); EN_LAST_LIST.add("leigh"); EN_LAST_LIST.add("pound"); EN_LAST_LIST.add("dine"); EN_LAST_LIST.add("fy"); EN_LAST_LIST.add("leign"); EN_LAST_LIST.add("sil"); EN_LAST_LIST.add("ga"); EN_LAST_LIST.add("ge"); EN_LAST_LIST.add("troy"); EN_LAST_LIST.add("dwight"); EN_LAST_LIST.add("nions"); EN_LAST_LIST.add("go"); EN_LAST_LIST.add("soll"); EN_LAST_LIST.add("greve"); EN_LAST_LIST.add("clare"); EN_LAST_LIST.add("vieve"); EN_LAST_LIST.add("gy"); EN_LAST_LIST.add("clark"); EN_LAST_LIST.add("hue"); EN_LAST_LIST.add("fort"); EN_LAST_LIST.add("bia"); EN_LAST_LIST.add("grant"); EN_LAST_LIST.add("he"); EN_LAST_LIST.add("holt"); EN_LAST_LIST.add("hum"); EN_LAST_LIST.add("bin"); EN_LAST_LIST.add("yonng"); EN_LAST_LIST.add("soon"); EN_LAST_LIST.add("hy"); EN_LAST_LIST.add("fra"); EN_LAST_LIST.add("chloe"); EN_LAST_LIST.add("briel"); EN_LAST_LIST.add("burns"); EN_LAST_LIST.add("phia"); EN_LAST_LIST.add("kerr"); EN_LAST_LIST.add("bitt"); EN_LAST_LIST.add("tience"); EN_LAST_LIST.add("brey"); EN_LAST_LIST.add("hood"); EN_LAST_LIST.add("bell"); EN_LAST_LIST.add("phil"); EN_LAST_LIST.add("field"); EN_LAST_LIST.add("steele"); EN_LAST_LIST.add("pritt"); EN_LAST_LIST.add("john"); EN_LAST_LIST.add("je"); EN_LAST_LIST.add("joyce"); EN_LAST_LIST.add("don"); EN_LAST_LIST.add("jo"); EN_LAST_LIST.add("jy"); EN_LAST_LIST.add("mag"); EN_LAST_LIST.add("blair"); EN_LAST_LIST.add("ke"); EN_LAST_LIST.add("man"); EN_LAST_LIST.add("mas"); EN_LAST_LIST.add("mar"); EN_LAST_LIST.add("may"); EN_LAST_LIST.add("max"); EN_LAST_LIST.add("sopp"); EN_LAST_LIST.add("ment"); EN_LAST_LIST.add("mens"); EN_LAST_LIST.add("ky"); EN_LAST_LIST.add("o'neil"); EN_LAST_LIST.add("la"); EN_LAST_LIST.add("le"); EN_LAST_LIST.add("stuart"); EN_LAST_LIST.add("li"); EN_LAST_LIST.add("ghes"); EN_LAST_LIST.add("hicks"); EN_LAST_LIST.add("dred"); EN_LAST_LIST.add("lo"); EN_LAST_LIST.add("drea"); EN_LAST_LIST.add("vans"); EN_LAST_LIST.add("ly"); EN_LAST_LIST.add("wright"); EN_LAST_LIST.add("som"); EN_LAST_LIST.add("logg"); EN_LAST_LIST.add("dra"); EN_LAST_LIST.add("son"); EN_LAST_LIST.add("ma"); EN_LAST_LIST.add("tham"); EN_LAST_LIST.add("berg"); EN_LAST_LIST.add("dith"); EN_LAST_LIST.add("dre"); EN_LAST_LIST.add("than"); EN_LAST_LIST.add("sor"); EN_LAST_LIST.add("me"); EN_LAST_LIST.add("noah"); EN_LAST_LIST.add("phne"); EN_LAST_LIST.add("brian"); EN_LAST_LIST.add("brook"); EN_LAST_LIST.add("mo"); EN_LAST_LIST.add("harine"); EN_LAST_LIST.add("lance"); EN_LAST_LIST.add("tate"); EN_LAST_LIST.add("my"); EN_LAST_LIST.add("yule"); EN_LAST_LIST.add("na"); EN_LAST_LIST.add("bob"); EN_LAST_LIST.add("nd"); EN_LAST_LIST.add("ne"); EN_LAST_LIST.add("bon"); EN_LAST_LIST.add("no"); EN_LAST_LIST.add("louie"); EN_LAST_LIST.add("sean"); EN_LAST_LIST.add("ny"); EN_LAST_LIST.add("bess"); EN_LAST_LIST.add("meg"); EN_LAST_LIST.add("tiane"); EN_LAST_LIST.add("head"); EN_LAST_LIST.add("hous"); EN_LAST_LIST.add("meo"); EN_LAST_LIST.add("men"); EN_LAST_LIST.add("beth"); EN_LAST_LIST.add("bald"); EN_LAST_LIST.add("louis"); EN_LAST_LIST.add("mer"); EN_LAST_LIST.add("boyle"); EN_LAST_LIST.add("mew"); EN_LAST_LIST.add("ville"); EN_LAST_LIST.add("kay"); EN_LAST_LIST.add("clair"); EN_LAST_LIST.add("tave"); EN_LAST_LIST.add("bert"); EN_LAST_LIST.add("finn"); EN_LAST_LIST.add("drey"); EN_LAST_LIST.add("burne"); EN_LAST_LIST.add("drew"); EN_LAST_LIST.add("dell"); EN_LAST_LIST.add("pe"); EN_LAST_LIST.add("fitch"); EN_LAST_LIST.add("ps"); EN_LAST_LIST.add("dric"); EN_LAST_LIST.add("beard"); EN_LAST_LIST.add("py"); EN_LAST_LIST.add("walsh"); EN_LAST_LIST.add("thew"); EN_LAST_LIST.add("qe"); EN_LAST_LIST.add("chols"); EN_LAST_LIST.add("brow"); EN_LAST_LIST.add("ther"); EN_LAST_LIST.add("noel"); EN_LAST_LIST.add("they"); EN_LAST_LIST.add("clough"); EN_LAST_LIST.add("thea"); EN_LAST_LIST.add("ckens"); EN_LAST_LIST.add("qy"); EN_LAST_LIST.add("thel"); EN_LAST_LIST.add("ra"); EN_LAST_LIST.add("booth"); EN_LAST_LIST.add("re"); EN_LAST_LIST.add("trine"); EN_LAST_LIST.add("rl"); EN_LAST_LIST.add("loise"); EN_LAST_LIST.add("ro"); EN_LAST_LIST.add("rist"); EN_LAST_LIST.add("mia"); EN_LAST_LIST.add("ry"); EN_LAST_LIST.add("mie"); EN_LAST_LIST.add("dair"); EN_LAST_LIST.add("sa"); EN_LAST_LIST.add("se"); EN_LAST_LIST.add("min"); EN_LAST_LIST.add("ken"); EN_LAST_LIST.add("sh"); EN_LAST_LIST.add("belle"); EN_LAST_LIST.add("ian"); EN_LAST_LIST.add("lian"); EN_LAST_LIST.add("fith"); EN_LAST_LIST.add("kes"); EN_LAST_LIST.add("ker"); EN_LAST_LIST.add("sibyl"); EN_LAST_LIST.add("fred"); EN_LAST_LIST.add("liam"); EN_LAST_LIST.add("wolf"); EN_LAST_LIST.add("sy"); EN_LAST_LIST.add("mann"); EN_LAST_LIST.add("lome"); EN_LAST_LIST.add("josh"); EN_LAST_LIST.add("ta"); EN_LAST_LIST.add("flower"); EN_LAST_LIST.add("te"); EN_LAST_LIST.add("hill"); EN_LAST_LIST.add("stan"); EN_LAST_LIST.add("mand"); EN_LAST_LIST.add("stal"); EN_LAST_LIST.add("to"); EN_LAST_LIST.add("bur"); EN_LAST_LIST.add("dys"); EN_LAST_LIST.add("ty"); EN_LAST_LIST.add("ice"); EN_LAST_LIST.add("woolf"); EN_LAST_LIST.add("jean"); EN_LAST_LIST.add("wood"); EN_LAST_LIST.add("bard"); EN_LAST_LIST.add("zel"); EN_LAST_LIST.add("crane"); EN_LAST_LIST.add("zer"); EN_LAST_LIST.add("va"); EN_LAST_LIST.add("lice"); EN_LAST_LIST.add("ve"); EN_LAST_LIST.add("frey"); EN_LAST_LIST.add("vi"); EN_LAST_LIST.add("wyatt"); EN_LAST_LIST.add("thia"); EN_LAST_LIST.add("sing"); EN_LAST_LIST.add("coln"); EN_LAST_LIST.add("vy"); EN_LAST_LIST.add("colm"); EN_LAST_LIST.add("nold"); EN_LAST_LIST.add("cole"); EN_LAST_LIST.add("dams"); EN_LAST_LIST.add("we"); EN_LAST_LIST.add("jill"); EN_LAST_LIST.add("gai"); EN_LAST_LIST.add("kim"); EN_LAST_LIST.add("kin"); EN_LAST_LIST.add("ien"); EN_LAST_LIST.add("gan"); EN_LAST_LIST.add("kit"); EN_LAST_LIST.add("nolds"); EN_LAST_LIST.add("drow"); EN_LAST_LIST.add("gar"); EN_LAST_LIST.add("liet"); EN_LAST_LIST.add("wy"); EN_LAST_LIST.add("xe"); EN_LAST_LIST.add("bart"); EN_LAST_LIST.add("stone"); EN_LAST_LIST.add("thodore"); EN_LAST_LIST.add("ster"); EN_LAST_LIST.add("mark"); EN_LAST_LIST.add("xy"); EN_LAST_LIST.add("jeff"); EN_LAST_LIST.add("laide"); EN_LAST_LIST.add("jeames"); EN_LAST_LIST.add("ye"); EN_LAST_LIST.add("mon"); EN_LAST_LIST.add("mos"); EN_LAST_LIST.add("maud"); EN_LAST_LIST.add("niah"); EN_LAST_LIST.add("price"); EN_LAST_LIST.add("zie"); EN_LAST_LIST.add("yy"); EN_LAST_LIST.add("van"); EN_LAST_LIST.add("matt"); EN_LAST_LIST.add("keith"); EN_LAST_LIST.add("ze"); EN_LAST_LIST.add("ckey"); EN_LAST_LIST.add("cker"); EN_LAST_LIST.add("zy"); EN_LAST_LIST.add("gee"); EN_LAST_LIST.add("north"); EN_LAST_LIST.add("james"); EN_LAST_LIST.add("claire"); EN_LAST_LIST.add("gel"); EN_LAST_LIST.add("nick"); EN_LAST_LIST.add("gen"); EN_LAST_LIST.add("ges"); EN_LAST_LIST.add("ger"); EN_LAST_LIST.add("kyle"); EN_LAST_LIST.add("morse"); EN_LAST_LIST.add("get"); EN_LAST_LIST.add("tricia"); EN_LAST_LIST.add("wilde"); EN_LAST_LIST.add("cook"); EN_LAST_LIST.add("sell"); EN_LAST_LIST.add("thune"); EN_LAST_LIST.add("nice"); EN_LAST_LIST.add("pold"); EN_LAST_LIST.add("nore"); EN_LAST_LIST.add("pole"); EN_LAST_LIST.add("tours"); EN_LAST_LIST.add("xia"); EN_LAST_LIST.add("niel"); EN_LAST_LIST.add("tab"); EN_LAST_LIST.add("ven"); EN_LAST_LIST.add("ver"); EN_LAST_LIST.add("lotte"); EN_LAST_LIST.add("vey"); EN_LAST_LIST.add("niei"); EN_LAST_LIST.add("webb"); EN_LAST_LIST.add("cooke"); EN_LAST_LIST.add("gia"); EN_LAST_LIST.add("lind"); EN_LAST_LIST.add("gie"); EN_LAST_LIST.add("dave"); EN_LAST_LIST.add("ruth"); EN_LAST_LIST.add("cott"); EN_LAST_LIST.add("ling"); EN_LAST_LIST.add("line"); EN_LAST_LIST.add("cah"); EN_LAST_LIST.add("gil"); EN_LAST_LIST.add("cam"); EN_LAST_LIST.add("ckle"); EN_LAST_LIST.add("leen"); EN_LAST_LIST.add("can"); EN_LAST_LIST.add("zoe"); EN_LAST_LIST.add("cas"); EN_LAST_LIST.add("car"); EN_LAST_LIST.add("buck"); EN_LAST_LIST.add("wells"); EN_LAST_LIST.add("ine"); EN_LAST_LIST.add("ing"); EN_LAST_LIST.add("will"); EN_LAST_LIST.add("rhys"); EN_LAST_LIST.add("rusk"); EN_LAST_LIST.add("jack"); EN_LAST_LIST.add("ledk"); EN_LAST_LIST.add("stowe"); EN_LAST_LIST.add("york"); EN_LAST_LIST.add("hearst"); EN_LAST_LIST.add("reade"); EN_LAST_LIST.add("loyd"); EN_LAST_LIST.add("wild"); EN_LAST_LIST.add("seph"); EN_LAST_LIST.add("gust"); EN_LAST_LIST.add("sper"); } public static void initCN_LAST_NAME() { CN_LAST_NAME.add("怀"); CN_LAST_NAME.add("老"); CN_LAST_NAME.add("堂"); CN_LAST_NAME.add("考"); CN_LAST_NAME.add("太史"); CN_LAST_NAME.add("逄"); CN_LAST_NAME.add("栋"); CN_LAST_NAME.add("闻人"); CN_LAST_NAME.add("树"); CN_LAST_NAME.add("栗"); CN_LAST_NAME.add("候"); CN_LAST_NAME.add("通"); CN_LAST_NAME.add("速"); CN_LAST_NAME.add("校"); CN_LAST_NAME.add("逢"); CN_LAST_NAME.add("性"); CN_LAST_NAME.add("倪"); CN_LAST_NAME.add("逮"); CN_LAST_NAME.add("逯"); CN_LAST_NAME.add("堵"); CN_LAST_NAME.add("栾"); CN_LAST_NAME.add("耿"); CN_LAST_NAME.add("桂"); CN_LAST_NAME.add("聂"); CN_LAST_NAME.add("衅"); CN_LAST_NAME.add("遇"); CN_LAST_NAME.add("聊"); CN_LAST_NAME.add("行"); CN_LAST_NAME.add("桐"); CN_LAST_NAME.add("桑"); CN_LAST_NAME.add("道"); CN_LAST_NAME.add("桓"); CN_LAST_NAME.add("塔"); CN_LAST_NAME.add("硕"); CN_LAST_NAME.add("尤念"); CN_LAST_NAME.add("塞"); CN_LAST_NAME.add("衡"); CN_LAST_NAME.add("衣"); CN_LAST_NAME.add("桥"); CN_LAST_NAME.add("令狐"); CN_LAST_NAME.add("表"); CN_LAST_NAME.add("张简"); CN_LAST_NAME.add("恭"); CN_LAST_NAME.add("偶"); CN_LAST_NAME.add("衷"); CN_LAST_NAME.add("项"); CN_LAST_NAME.add("须"); CN_LAST_NAME.add("恽"); CN_LAST_NAME.add("顾"); CN_LAST_NAME.add("顿"); CN_LAST_NAME.add("梁"); CN_LAST_NAME.add("袁"); CN_LAST_NAME.add("漆雕"); CN_LAST_NAME.add("梅"); CN_LAST_NAME.add("傅"); CN_LAST_NAME.add("肇"); CN_LAST_NAME.add("悉"); CN_LAST_NAME.add("夏侯"); CN_LAST_NAME.add("频"); CN_LAST_NAME.add("邓"); CN_LAST_NAME.add("肖"); CN_LAST_NAME.add("邗"); CN_LAST_NAME.add("邛"); CN_LAST_NAME.add("章佳"); CN_LAST_NAME.add("颜"); CN_LAST_NAME.add("邝"); CN_LAST_NAME.add("悟"); CN_LAST_NAME.add("邢"); CN_LAST_NAME.add("那"); CN_LAST_NAME.add("肥"); CN_LAST_NAME.add("碧"); CN_LAST_NAME.add("储"); CN_LAST_NAME.add("墨"); CN_LAST_NAME.add("邬"); CN_LAST_NAME.add("袭"); CN_LAST_NAME.add("邰"); CN_LAST_NAME.add("邱"); CN_LAST_NAME.add("邴"); CN_LAST_NAME.add("邵"); CN_LAST_NAME.add("碧鲁"); CN_LAST_NAME.add("邶"); CN_LAST_NAME.add("邸"); CN_LAST_NAME.add("邹"); CN_LAST_NAME.add("检"); CN_LAST_NAME.add("郁"); CN_LAST_NAME.add("郎"); CN_LAST_NAME.add("风"); CN_LAST_NAME.add("郏"); CN_LAST_NAME.add("郑"); CN_LAST_NAME.add("裔"); CN_LAST_NAME.add("郗"); CN_LAST_NAME.add("裘"); CN_LAST_NAME.add("郜"); CN_LAST_NAME.add("郝"); CN_LAST_NAME.add("飞"); CN_LAST_NAME.add("烟"); CN_LAST_NAME.add("惠"); CN_LAST_NAME.add("胡"); CN_LAST_NAME.add("胥"); CN_LAST_NAME.add("郦"); CN_LAST_NAME.add("僧"); CN_LAST_NAME.add("第五"); CN_LAST_NAME.add("磨"); CN_LAST_NAME.add("僪"); CN_LAST_NAME.add("由念"); CN_LAST_NAME.add("士"); CN_LAST_NAME.add("壬"); CN_LAST_NAME.add("郭"); CN_LAST_NAME.add("钟离"); CN_LAST_NAME.add("森"); CN_LAST_NAME.add("郯"); CN_LAST_NAME.add("声"); CN_LAST_NAME.add("裴"); CN_LAST_NAME.add("郸"); CN_LAST_NAME.add("都"); CN_LAST_NAME.add("能"); CN_LAST_NAME.add("鄂"); CN_LAST_NAME.add("愈"); CN_LAST_NAME.add("焉"); CN_LAST_NAME.add("植"); CN_LAST_NAME.add("夏"); CN_LAST_NAME.add("褒"); CN_LAST_NAME.add("夔"); CN_LAST_NAME.add("夕"); CN_LAST_NAME.add("夙"); CN_LAST_NAME.add("多"); CN_LAST_NAME.add("褚"); CN_LAST_NAME.add("愚"); CN_LAST_NAME.add("鄞"); CN_LAST_NAME.add("鄢"); CN_LAST_NAME.add("焦"); CN_LAST_NAME.add("大"); CN_LAST_NAME.add("天"); CN_LAST_NAME.add("夫"); CN_LAST_NAME.add("脱"); CN_LAST_NAME.add("夷"); CN_LAST_NAME.add("示"); CN_LAST_NAME.add("礼"); CN_LAST_NAME.add("祁"); CN_LAST_NAME.add("允"); CN_LAST_NAME.add("元"); CN_LAST_NAME.add("充"); CN_LAST_NAME.add("兆"); CN_LAST_NAME.add("酆"); CN_LAST_NAME.add("奇"); CN_LAST_NAME.add("祈"); CN_LAST_NAME.add("慈"); CN_LAST_NAME.add("奈"); CN_LAST_NAME.add("奉"); CN_LAST_NAME.add("光"); CN_LAST_NAME.add("慎"); CN_LAST_NAME.add("段干"); CN_LAST_NAME.add("酒"); CN_LAST_NAME.add("慕"); CN_LAST_NAME.add("奕"); CN_LAST_NAME.add("祖"); CN_LAST_NAME.add("党"); CN_LAST_NAME.add("楚"); CN_LAST_NAME.add("奚"); CN_LAST_NAME.add("祝"); CN_LAST_NAME.add("祢"); CN_LAST_NAME.add("但念"); CN_LAST_NAME.add("全"); CN_LAST_NAME.add("公"); CN_LAST_NAME.add("六"); CN_LAST_NAME.add("祭"); CN_LAST_NAME.add("兰"); CN_LAST_NAME.add("关"); CN_LAST_NAME.add("兴"); CN_LAST_NAME.add("其"); CN_LAST_NAME.add("饶"); CN_LAST_NAME.add("典"); CN_LAST_NAME.add("养"); CN_LAST_NAME.add("楼"); CN_LAST_NAME.add("腾"); CN_LAST_NAME.add("冀"); CN_LAST_NAME.add("覃"); CN_LAST_NAME.add("禄"); CN_LAST_NAME.add("冉"); CN_LAST_NAME.add("熊"); CN_LAST_NAME.add("福"); CN_LAST_NAME.add("冒"); CN_LAST_NAME.add("首"); CN_LAST_NAME.add("富察"); CN_LAST_NAME.add("香"); CN_LAST_NAME.add("禚"); CN_LAST_NAME.add("军"); CN_LAST_NAME.add("农"); CN_LAST_NAME.add("冠"); CN_LAST_NAME.add("漆念"); CN_LAST_NAME.add("妫"); CN_LAST_NAME.add("冯"); CN_LAST_NAME.add("况"); CN_LAST_NAME.add("冷"); CN_LAST_NAME.add("禹"); CN_LAST_NAME.add("冼"); CN_LAST_NAME.add("禽"); CN_LAST_NAME.add("禾"); CN_LAST_NAME.add("释"); CN_LAST_NAME.add("秋"); CN_LAST_NAME.add("始"); CN_LAST_NAME.add("凌"); CN_LAST_NAME.add("种"); CN_LAST_NAME.add("野"); CN_LAST_NAME.add("金"); CN_LAST_NAME.add("姒"); CN_LAST_NAME.add("姓"); CN_LAST_NAME.add("委"); CN_LAST_NAME.add("燕"); CN_LAST_NAME.add("秘"); CN_LAST_NAME.add("姚"); CN_LAST_NAME.add("姜"); CN_LAST_NAME.add("解"); CN_LAST_NAME.add("凤"); CN_LAST_NAME.add("秦"); CN_LAST_NAME.add("臧"); CN_LAST_NAME.add("巫马"); CN_LAST_NAME.add("姬"); CN_LAST_NAME.add("凭"); CN_LAST_NAME.add("称"); CN_LAST_NAME.add("呼延"); CN_LAST_NAME.add("乌雅"); CN_LAST_NAME.add("出"); CN_LAST_NAME.add("函"); CN_LAST_NAME.add("言"); CN_LAST_NAME.add("刀"); CN_LAST_NAME.add("刁"); CN_LAST_NAME.add("威"); CN_LAST_NAME.add("娄"); CN_LAST_NAME.add("戈"); CN_LAST_NAME.add("樊"); CN_LAST_NAME.add("戊"); CN_LAST_NAME.add("程"); CN_LAST_NAME.add("戎"); CN_LAST_NAME.add("税"); CN_LAST_NAME.add("戏"); CN_LAST_NAME.add("成"); CN_LAST_NAME.add("刑"); CN_LAST_NAME.add("舒"); CN_LAST_NAME.add("夹谷"); CN_LAST_NAME.add("端木"); CN_LAST_NAME.add("刘"); CN_LAST_NAME.add("战"); CN_LAST_NAME.add("戚"); CN_LAST_NAME.add("刚"); CN_LAST_NAME.add("舜"); CN_LAST_NAME.add("初"); CN_LAST_NAME.add("戢"); CN_LAST_NAME.add("利"); CN_LAST_NAME.add("别"); CN_LAST_NAME.add("爱"); CN_LAST_NAME.add("戴"); CN_LAST_NAME.add("户"); CN_LAST_NAME.add("稽"); CN_LAST_NAME.add("訾"); CN_LAST_NAME.add("房"); CN_LAST_NAME.add("所"); CN_LAST_NAME.add("穆"); CN_LAST_NAME.add("扈"); CN_LAST_NAME.add("前"); CN_LAST_NAME.add("才"); CN_LAST_NAME.add("剑"); CN_LAST_NAME.add("牛"); CN_LAST_NAME.add("牟"); CN_LAST_NAME.add("牢"); CN_LAST_NAME.add("剧"); CN_LAST_NAME.add("牧"); CN_LAST_NAME.add("马"); CN_LAST_NAME.add("扬"); CN_LAST_NAME.add("良"); CN_LAST_NAME.add("穰"); CN_LAST_NAME.add("牵"); CN_LAST_NAME.add("扶"); CN_LAST_NAME.add("驹"); CN_LAST_NAME.add("詹"); CN_LAST_NAME.add("空"); CN_LAST_NAME.add("艾"); CN_LAST_NAME.add("承"); CN_LAST_NAME.add("檀"); CN_LAST_NAME.add("犁"); CN_LAST_NAME.add("节"); CN_LAST_NAME.add("抄"); CN_LAST_NAME.add("骆"); CN_LAST_NAME.add("司徒"); CN_LAST_NAME.add("骑"); CN_LAST_NAME.add("芒"); CN_LAST_NAME.add("马佳"); CN_LAST_NAME.add("抗"); CN_LAST_NAME.add("折"); CN_LAST_NAME.add("力"); CN_LAST_NAME.add("功"); CN_LAST_NAME.add("务"); CN_LAST_NAME.add("窦"); CN_LAST_NAME.add("芮"); CN_LAST_NAME.add("仲孙"); CN_LAST_NAME.add("励"); CN_LAST_NAME.add("花"); CN_LAST_NAME.add("万俟"); CN_LAST_NAME.add("劳"); CN_LAST_NAME.add("犹"); CN_LAST_NAME.add("势"); CN_LAST_NAME.add("狂"); CN_LAST_NAME.add("狄"); CN_LAST_NAME.add("勇"); CN_LAST_NAME.add("苌"); CN_LAST_NAME.add("苍"); CN_LAST_NAME.add("苏"); CN_LAST_NAME.add("苑"); CN_LAST_NAME.add("苗"); CN_LAST_NAME.add("高"); CN_LAST_NAME.add("招"); CN_LAST_NAME.add("拜"); CN_LAST_NAME.add("苟"); CN_LAST_NAME.add("章"); CN_LAST_NAME.add("勤"); CN_LAST_NAME.add("童"); CN_LAST_NAME.add("苦"); CN_LAST_NAME.add("宇文"); CN_LAST_NAME.add("独"); CN_LAST_NAME.add("竭"); CN_LAST_NAME.add("端"); CN_LAST_NAME.add("拱"); CN_LAST_NAME.add("英"); CN_LAST_NAME.add("竹"); CN_LAST_NAME.add("竺"); CN_LAST_NAME.add("勾"); CN_LAST_NAME.add("百里"); CN_LAST_NAME.add("茂"); CN_LAST_NAME.add("范"); CN_LAST_NAME.add("笃"); CN_LAST_NAME.add("包"); CN_LAST_NAME.add("茅"); CN_LAST_NAME.add("茆"); CN_LAST_NAME.add("謇"); CN_LAST_NAME.add("东方"); CN_LAST_NAME.add("化"); CN_LAST_NAME.add("北"); CN_LAST_NAME.add("次"); CN_LAST_NAME.add("匡"); CN_LAST_NAME.add("符"); CN_LAST_NAME.add("欧"); CN_LAST_NAME.add("笪"); CN_LAST_NAME.add("第"); CN_LAST_NAME.add("嬴"); CN_LAST_NAME.add("茹"); CN_LAST_NAME.add("区"); CN_LAST_NAME.add("谷梁"); CN_LAST_NAME.add("微生"); CN_LAST_NAME.add("南宫"); CN_LAST_NAME.add("荀"); CN_LAST_NAME.add("千"); CN_LAST_NAME.add("东门"); CN_LAST_NAME.add("荆"); CN_LAST_NAME.add("华"); CN_LAST_NAME.add("魏"); CN_LAST_NAME.add("卑"); CN_LAST_NAME.add("卓"); CN_LAST_NAME.add("答"); CN_LAST_NAME.add("孔"); CN_LAST_NAME.add("单"); CN_LAST_NAME.add("字"); CN_LAST_NAME.add("南"); CN_LAST_NAME.add("孙"); CN_LAST_NAME.add("澹台"); CN_LAST_NAME.add("孛"); CN_LAST_NAME.add("卜"); CN_LAST_NAME.add("孝"); CN_LAST_NAME.add("卞"); CN_LAST_NAME.add("孟"); CN_LAST_NAME.add("占"); CN_LAST_NAME.add("止"); CN_LAST_NAME.add("卢"); CN_LAST_NAME.add("荣"); CN_LAST_NAME.add("季"); CN_LAST_NAME.add("荤"); CN_LAST_NAME.add("步"); CN_LAST_NAME.add("学"); CN_LAST_NAME.add("武"); CN_LAST_NAME.add("歧"); CN_LAST_NAME.add("卫"); CN_LAST_NAME.add("卯"); CN_LAST_NAME.add("印"); CN_LAST_NAME.add("危"); CN_LAST_NAME.add("却"); CN_LAST_NAME.add("卷"); CN_LAST_NAME.add("捷"); CN_LAST_NAME.add("卿"); CN_LAST_NAME.add("简"); CN_LAST_NAME.add("宁"); CN_LAST_NAME.add("玄"); CN_LAST_NAME.add("历"); CN_LAST_NAME.add("宇"); CN_LAST_NAME.add("守"); CN_LAST_NAME.add("安"); CN_LAST_NAME.add("玉"); CN_LAST_NAME.add("厉"); CN_LAST_NAME.add("穰念"); CN_LAST_NAME.add("宋"); CN_LAST_NAME.add("王"); CN_LAST_NAME.add("掌"); CN_LAST_NAME.add("完"); CN_LAST_NAME.add("厍"); CN_LAST_NAME.add("宏"); CN_LAST_NAME.add("宓"); CN_LAST_NAME.add("公羊"); CN_LAST_NAME.add("箕"); CN_LAST_NAME.add("宗"); CN_LAST_NAME.add("莘"); CN_LAST_NAME.add("官"); CN_LAST_NAME.add("厚"); CN_LAST_NAME.add("定"); CN_LAST_NAME.add("宛"); CN_LAST_NAME.add("宜"); CN_LAST_NAME.add("宝"); CN_LAST_NAME.add("实"); CN_LAST_NAME.add("原"); CN_LAST_NAME.add("管"); CN_LAST_NAME.add("计"); CN_LAST_NAME.add("妫念"); CN_LAST_NAME.add("宣"); CN_LAST_NAME.add("接"); CN_LAST_NAME.add("宦"); CN_LAST_NAME.add("让"); CN_LAST_NAME.add("莫"); CN_LAST_NAME.add("宫"); CN_LAST_NAME.add("环"); CN_LAST_NAME.add("宰"); CN_LAST_NAME.add("莱"); CN_LAST_NAME.add("殳"); CN_LAST_NAME.add("段"); CN_LAST_NAME.add("家"); CN_LAST_NAME.add("殷"); CN_LAST_NAME.add("许"); CN_LAST_NAME.add("容"); CN_LAST_NAME.add("张廖"); CN_LAST_NAME.add("宾"); CN_LAST_NAME.add("宿"); CN_LAST_NAME.add("菅"); CN_LAST_NAME.add("寇"); CN_LAST_NAME.add("及"); CN_LAST_NAME.add("毋"); CN_LAST_NAME.add("友"); CN_LAST_NAME.add("富"); CN_LAST_NAME.add("双"); CN_LAST_NAME.add("羊舌"); CN_LAST_NAME.add("母"); CN_LAST_NAME.add("寒"); CN_LAST_NAME.add("锺离"); CN_LAST_NAME.add("毓"); CN_LAST_NAME.add("叔"); CN_LAST_NAME.add("毕"); CN_LAST_NAME.add("诗"); CN_LAST_NAME.add("受"); CN_LAST_NAME.add("毛"); CN_LAST_NAME.add("古"); CN_LAST_NAME.add("召"); CN_LAST_NAME.add("揭"); CN_LAST_NAME.add("班"); CN_LAST_NAME.add("可"); CN_LAST_NAME.add("台"); CN_LAST_NAME.add("史"); CN_LAST_NAME.add("说"); CN_LAST_NAME.add("叶"); CN_LAST_NAME.add("寸"); CN_LAST_NAME.add("诸"); CN_LAST_NAME.add("司"); CN_LAST_NAME.add("诺"); CN_LAST_NAME.add("寻"); CN_LAST_NAME.add("佟佳"); CN_LAST_NAME.add("寿"); CN_LAST_NAME.add("封"); CN_LAST_NAME.add("理"); CN_LAST_NAME.add("将"); CN_LAST_NAME.add("谈"); CN_LAST_NAME.add("合"); CN_LAST_NAME.add("尉"); CN_LAST_NAME.add("吉"); CN_LAST_NAME.add("濮阳"); CN_LAST_NAME.add("同"); CN_LAST_NAME.add("谌"); CN_LAST_NAME.add("后"); CN_LAST_NAME.add("谏"); CN_LAST_NAME.add("少"); CN_LAST_NAME.add("向"); CN_LAST_NAME.add("尔"); CN_LAST_NAME.add("吕"); CN_LAST_NAME.add("尚"); CN_LAST_NAME.add("封念"); CN_LAST_NAME.add("谢"); CN_LAST_NAME.add("尤"); CN_LAST_NAME.add("营"); CN_LAST_NAME.add("琦"); CN_LAST_NAME.add("尧"); CN_LAST_NAME.add("萧"); CN_LAST_NAME.add("萨"); CN_LAST_NAME.add("谬"); CN_LAST_NAME.add("谭"); CN_LAST_NAME.add("谯"); CN_LAST_NAME.add("琴"); CN_LAST_NAME.add("水"); CN_LAST_NAME.add("吴"); CN_LAST_NAME.add("谷"); CN_LAST_NAME.add("永"); CN_LAST_NAME.add("尹"); CN_LAST_NAME.add("吾"); CN_LAST_NAME.add("尾"); CN_LAST_NAME.add("局"); CN_LAST_NAME.add("求"); CN_LAST_NAME.add("居"); CN_LAST_NAME.add("豆"); CN_LAST_NAME.add("屈"); CN_LAST_NAME.add("汉"); CN_LAST_NAME.add("告"); CN_LAST_NAME.add("籍"); CN_LAST_NAME.add("展"); CN_LAST_NAME.add("汗"); CN_LAST_NAME.add("西门"); CN_LAST_NAME.add("员"); CN_LAST_NAME.add("葛"); CN_LAST_NAME.add("汝"); CN_LAST_NAME.add("瑞"); CN_LAST_NAME.add("江"); CN_LAST_NAME.add("屠"); CN_LAST_NAME.add("池"); CN_LAST_NAME.add("象"); CN_LAST_NAME.add("董"); CN_LAST_NAME.add("汤"); CN_LAST_NAME.add("周"); CN_LAST_NAME.add("摩"); CN_LAST_NAME.add("汪"); CN_LAST_NAME.add("山"); CN_LAST_NAME.add("汲"); CN_LAST_NAME.add("米"); CN_LAST_NAME.add("类"); CN_LAST_NAME.add("鱼"); CN_LAST_NAME.add("呼"); CN_LAST_NAME.add("鲁"); CN_LAST_NAME.add("宗政"); CN_LAST_NAME.add("沃"); CN_LAST_NAME.add("针"); CN_LAST_NAME.add("沈"); CN_LAST_NAME.add("蒉"); CN_LAST_NAME.add("钊"); CN_LAST_NAME.add("貊"); CN_LAST_NAME.add("蒋"); CN_LAST_NAME.add("和"); CN_LAST_NAME.add("鲍"); CN_LAST_NAME.add("宰父"); CN_LAST_NAME.add("咎"); CN_LAST_NAME.add("沐"); CN_LAST_NAME.add("岑"); CN_LAST_NAME.add("撒"); CN_LAST_NAME.add("粘"); CN_LAST_NAME.add("沙"); CN_LAST_NAME.add("蒙"); CN_LAST_NAME.add("鲜"); CN_LAST_NAME.add("钞"); CN_LAST_NAME.add("钟"); CN_LAST_NAME.add("粟"); CN_LAST_NAME.add("钦"); CN_LAST_NAME.add("璩"); CN_LAST_NAME.add("钭"); CN_LAST_NAME.add("钮"); CN_LAST_NAME.add("蒯"); CN_LAST_NAME.add("钱"); CN_LAST_NAME.add("蒲"); CN_LAST_NAME.add("岳"); CN_LAST_NAME.add("咸"); CN_LAST_NAME.add("蒿"); CN_LAST_NAME.add("哀"); CN_LAST_NAME.add("翦念"); CN_LAST_NAME.add("铁"); CN_LAST_NAME.add("仲长"); CN_LAST_NAME.add("哈"); CN_LAST_NAME.add("泉"); CN_LAST_NAME.add("操"); CN_LAST_NAME.add("铎"); CN_LAST_NAME.add("法"); CN_LAST_NAME.add("糜"); CN_LAST_NAME.add("蓝"); CN_LAST_NAME.add("蓟"); CN_LAST_NAME.add("波"); CN_LAST_NAME.add("泣"); CN_LAST_NAME.add("泥"); CN_LAST_NAME.add("蓬"); CN_LAST_NAME.add("瓮"); CN_LAST_NAME.add("泰"); CN_LAST_NAME.add("银"); CN_LAST_NAME.add("泷"); CN_LAST_NAME.add("左丘"); CN_LAST_NAME.add("系"); CN_LAST_NAME.add("尉迟"); CN_LAST_NAME.add("锁"); CN_LAST_NAME.add("甄"); CN_LAST_NAME.add("崇"); CN_LAST_NAME.add("慕容"); CN_LAST_NAME.add("洋"); CN_LAST_NAME.add("锐"); CN_LAST_NAME.add("唐"); CN_LAST_NAME.add("崔"); CN_LAST_NAME.add("甘"); CN_LAST_NAME.add("错"); CN_LAST_NAME.add("蔚"); CN_LAST_NAME.add("洛"); CN_LAST_NAME.add("贝"); CN_LAST_NAME.add("生"); CN_LAST_NAME.add("素"); CN_LAST_NAME.add("贡"); CN_LAST_NAME.add("蔡"); CN_LAST_NAME.add("索"); CN_LAST_NAME.add("用"); CN_LAST_NAME.add("洪"); CN_LAST_NAME.add("甫"); CN_LAST_NAME.add("紫"); CN_LAST_NAME.add("贯"); CN_LAST_NAME.add("支"); CN_LAST_NAME.add("贰"); CN_LAST_NAME.add("田"); CN_LAST_NAME.add("由"); CN_LAST_NAME.add("贲"); CN_LAST_NAME.add("甲"); CN_LAST_NAME.add("申"); CN_LAST_NAME.add("贵"); CN_LAST_NAME.add("贸"); CN_LAST_NAME.add("费"); CN_LAST_NAME.add("改"); CN_LAST_NAME.add("锺"); CN_LAST_NAME.add("贺"); CN_LAST_NAME.add("蔺"); CN_LAST_NAME.add("纳喇"); CN_LAST_NAME.add("贾"); CN_LAST_NAME.add("资"); CN_LAST_NAME.add("畅"); CN_LAST_NAME.add("商"); CN_LAST_NAME.add("镇"); CN_LAST_NAME.add("嵇"); CN_LAST_NAME.add("敏"); CN_LAST_NAME.add("赏"); CN_LAST_NAME.add("浑"); CN_LAST_NAME.add("拓跋"); CN_LAST_NAME.add("敖"); CN_LAST_NAME.add("赖"); CN_LAST_NAME.add("留"); CN_LAST_NAME.add("赛"); CN_LAST_NAME.add("敛"); CN_LAST_NAME.add("镜"); CN_LAST_NAME.add("轩辕"); CN_LAST_NAME.add("鲜于"); CN_LAST_NAME.add("赤"); CN_LAST_NAME.add("浦"); CN_LAST_NAME.add("赧"); CN_LAST_NAME.add("赫"); CN_LAST_NAME.add("敬"); CN_LAST_NAME.add("浮"); CN_LAST_NAME.add("赵"); CN_LAST_NAME.add("海"); CN_LAST_NAME.add("南门"); CN_LAST_NAME.add("司马"); CN_LAST_NAME.add("长"); CN_LAST_NAME.add("涂"); CN_LAST_NAME.add("申屠"); CN_LAST_NAME.add("费莫"); CN_LAST_NAME.add("薄"); CN_LAST_NAME.add("善"); CN_LAST_NAME.add("伦念"); CN_LAST_NAME.add("文"); CN_LAST_NAME.add("司空"); CN_LAST_NAME.add("越"); CN_LAST_NAME.add("斋"); CN_LAST_NAME.add("疏"); CN_LAST_NAME.add("斐"); CN_LAST_NAME.add("公西"); CN_LAST_NAME.add("薛"); CN_LAST_NAME.add("斛"); CN_LAST_NAME.add("喜"); CN_LAST_NAME.add("綦"); CN_LAST_NAME.add("长孙"); CN_LAST_NAME.add("斯"); CN_LAST_NAME.add("方"); CN_LAST_NAME.add("喻"); CN_LAST_NAME.add("梁丘"); CN_LAST_NAME.add("於"); CN_LAST_NAME.add("施"); CN_LAST_NAME.add("公冶"); CN_LAST_NAME.add("旁"); CN_LAST_NAME.add("旅"); CN_LAST_NAME.add("藏"); CN_LAST_NAME.add("单于"); CN_LAST_NAME.add("旗"); CN_LAST_NAME.add("无"); CN_LAST_NAME.add("淡"); CN_LAST_NAME.add("巢"); CN_LAST_NAME.add("藤"); CN_LAST_NAME.add("左"); CN_LAST_NAME.add("淦"); CN_LAST_NAME.add("巧"); CN_LAST_NAME.add("门"); CN_LAST_NAME.add("巨"); CN_LAST_NAME.add("藩"); CN_LAST_NAME.add("巩"); CN_LAST_NAME.add("闪"); CN_LAST_NAME.add("巫"); CN_LAST_NAME.add("闫"); CN_LAST_NAME.add("闭"); CN_LAST_NAME.add("问"); CN_LAST_NAME.add("路"); CN_LAST_NAME.add("己"); CN_LAST_NAME.add("闳"); CN_LAST_NAME.add("巴"); CN_LAST_NAME.add("闵"); CN_LAST_NAME.add("时"); CN_LAST_NAME.add("旷"); CN_LAST_NAME.add("闻"); CN_LAST_NAME.add("闽"); CN_LAST_NAME.add("闾"); CN_LAST_NAME.add("丁"); CN_LAST_NAME.add("市"); CN_LAST_NAME.add("昂"); CN_LAST_NAME.add("布"); CN_LAST_NAME.add("清"); CN_LAST_NAME.add("帅"); CN_LAST_NAME.add("万"); CN_LAST_NAME.add("师"); CN_LAST_NAME.add("嘉"); CN_LAST_NAME.add("希"); CN_LAST_NAME.add("昌"); CN_LAST_NAME.add("颛孙"); CN_LAST_NAME.add("不"); CN_LAST_NAME.add("阎"); CN_LAST_NAME.add("明"); CN_LAST_NAME.add("丑"); CN_LAST_NAME.add("易"); CN_LAST_NAME.add("昔"); CN_LAST_NAME.add("帖"); CN_LAST_NAME.add("世"); CN_LAST_NAME.add("丘"); CN_LAST_NAME.add("壤驷"); CN_LAST_NAME.add("阙"); CN_LAST_NAME.add("丙"); CN_LAST_NAME.add("阚"); CN_LAST_NAME.add("业"); CN_LAST_NAME.add("帛"); CN_LAST_NAME.add("丛"); CN_LAST_NAME.add("东"); CN_LAST_NAME.add("子车"); CN_LAST_NAME.add("昝"); CN_LAST_NAME.add("星"); CN_LAST_NAME.add("渠"); CN_LAST_NAME.add("严"); CN_LAST_NAME.add("春"); CN_LAST_NAME.add("温"); CN_LAST_NAME.add("席"); CN_LAST_NAME.add("中"); CN_LAST_NAME.add("阮"); CN_LAST_NAME.add("是"); CN_LAST_NAME.add("丰"); CN_LAST_NAME.add("阳"); CN_LAST_NAME.add("阴"); CN_LAST_NAME.add("常"); CN_LAST_NAME.add("游"); CN_LAST_NAME.add("丹"); CN_LAST_NAME.add("阿"); CN_LAST_NAME.add("陀"); CN_LAST_NAME.add("晁"); CN_LAST_NAME.add("繁"); CN_LAST_NAME.add("陆"); CN_LAST_NAME.add("蹇"); CN_LAST_NAME.add("么"); CN_LAST_NAME.add("陈"); CN_LAST_NAME.add("蹉"); CN_LAST_NAME.add("义"); CN_LAST_NAME.add("晋"); CN_LAST_NAME.add("之"); CN_LAST_NAME.add("乌"); CN_LAST_NAME.add("虎"); CN_LAST_NAME.add("晏"); CN_LAST_NAME.add("乐"); CN_LAST_NAME.add("乔"); CN_LAST_NAME.add("乘"); CN_LAST_NAME.add("乙"); CN_LAST_NAME.add("东郭"); CN_LAST_NAME.add("湛"); CN_LAST_NAME.add("乜"); CN_LAST_NAME.add("九"); CN_LAST_NAME.add("虞"); CN_LAST_NAME.add("习"); CN_LAST_NAME.add("虢"); CN_LAST_NAME.add("书"); CN_LAST_NAME.add("普"); CN_LAST_NAME.add("景"); CN_LAST_NAME.add("买"); CN_LAST_NAME.add("干"); CN_LAST_NAME.add("平"); CN_LAST_NAME.add("年"); CN_LAST_NAME.add("陶"); CN_LAST_NAME.add("幸"); CN_LAST_NAME.add("智"); CN_LAST_NAME.add("登"); CN_LAST_NAME.add("白"); CN_LAST_NAME.add("百"); CN_LAST_NAME.add("乾"); CN_LAST_NAME.add("鹿"); CN_LAST_NAME.add("广"); CN_LAST_NAME.add("蚁"); CN_LAST_NAME.add("乌孙"); CN_LAST_NAME.add("庄"); CN_LAST_NAME.add("隆"); CN_LAST_NAME.add("庆"); CN_LAST_NAME.add("皇"); CN_LAST_NAME.add("公良"); CN_LAST_NAME.add("皋"); CN_LAST_NAME.add("隋"); CN_LAST_NAME.add("柴念"); CN_LAST_NAME.add("于"); CN_LAST_NAME.add("随"); CN_LAST_NAME.add("源"); CN_LAST_NAME.add("隐"); CN_LAST_NAME.add("云"); CN_LAST_NAME.add("库"); CN_LAST_NAME.add("亓"); CN_LAST_NAME.add("应"); CN_LAST_NAME.add("五"); CN_LAST_NAME.add("井"); CN_LAST_NAME.add("隗"); CN_LAST_NAME.add("那拉"); CN_LAST_NAME.add("庚"); CN_LAST_NAME.add("完颜"); CN_LAST_NAME.add("府"); CN_LAST_NAME.add("庞"); CN_LAST_NAME.add("图门"); CN_LAST_NAME.add("红"); CN_LAST_NAME.add("亢"); CN_LAST_NAME.add("溥"); CN_LAST_NAME.add("亥"); CN_LAST_NAME.add("度"); CN_LAST_NAME.add("麦"); CN_LAST_NAME.add("暨"); CN_LAST_NAME.add("纪"); CN_LAST_NAME.add("京"); CN_LAST_NAME.add("皮"); CN_LAST_NAME.add("纳"); CN_LAST_NAME.add("暴"); CN_LAST_NAME.add("麴"); CN_LAST_NAME.add("纵"); CN_LAST_NAME.add("康"); CN_LAST_NAME.add("庹"); CN_LAST_NAME.add("麻"); CN_LAST_NAME.add("隽"); CN_LAST_NAME.add("庾"); CN_LAST_NAME.add("线"); CN_LAST_NAME.add("雀"); CN_LAST_NAME.add("仁"); CN_LAST_NAME.add("练"); CN_LAST_NAME.add("黄"); CN_LAST_NAME.add("司寇"); CN_LAST_NAME.add("仆"); CN_LAST_NAME.add("集"); CN_LAST_NAME.add("仇"); CN_LAST_NAME.add("上官"); CN_LAST_NAME.add("盈"); CN_LAST_NAME.add("终"); CN_LAST_NAME.add("廉"); CN_LAST_NAME.add("仉"); CN_LAST_NAME.add("益"); CN_LAST_NAME.add("介"); CN_LAST_NAME.add("盍"); CN_LAST_NAME.add("绍"); CN_LAST_NAME.add("雍"); CN_LAST_NAME.add("仍"); CN_LAST_NAME.add("从"); CN_LAST_NAME.add("黎"); CN_LAST_NAME.add("经"); CN_LAST_NAME.add("滑"); CN_LAST_NAME.add("滕"); CN_LAST_NAME.add("盖"); CN_LAST_NAME.add("廖"); CN_LAST_NAME.add("盘"); CN_LAST_NAME.add("仙"); CN_LAST_NAME.add("盛"); CN_LAST_NAME.add("仝"); CN_LAST_NAME.add("回"); CN_LAST_NAME.add("满"); CN_LAST_NAME.add("代"); CN_LAST_NAME.add("令"); CN_LAST_NAME.add("以"); CN_LAST_NAME.add("绪"); CN_LAST_NAME.add("雪"); CN_LAST_NAME.add("仪"); CN_LAST_NAME.add("续"); CN_LAST_NAME.add("蛮"); CN_LAST_NAME.add("仰"); CN_LAST_NAME.add("仲"); CN_LAST_NAME.add("曲"); CN_LAST_NAME.add("绳"); CN_LAST_NAME.add("仵"); CN_LAST_NAME.add("淳于"); CN_LAST_NAME.add("延"); CN_LAST_NAME.add("零"); CN_LAST_NAME.add("雷"); CN_LAST_NAME.add("相"); CN_LAST_NAME.add("曹"); CN_LAST_NAME.add("建"); CN_LAST_NAME.add("任"); CN_LAST_NAME.add("国"); CN_LAST_NAME.add("曾"); CN_LAST_NAME.add("开"); CN_LAST_NAME.add("漆"); CN_LAST_NAME.add("有"); CN_LAST_NAME.add("伊"); CN_LAST_NAME.add("朋"); CN_LAST_NAME.add("霍"); CN_LAST_NAME.add("伍"); CN_LAST_NAME.add("伏"); CN_LAST_NAME.add("缑"); CN_LAST_NAME.add("休"); CN_LAST_NAME.add("弓"); CN_LAST_NAME.add("弘"); CN_LAST_NAME.add("乐正"); CN_LAST_NAME.add("望"); CN_LAST_NAME.add("霜"); CN_LAST_NAME.add("伟"); CN_LAST_NAME.add("真"); CN_LAST_NAME.add("张"); CN_LAST_NAME.add("圣"); CN_LAST_NAME.add("弥"); CN_LAST_NAME.add("伦"); CN_LAST_NAME.add("在"); CN_LAST_NAME.add("范姜"); CN_LAST_NAME.add("缪"); CN_LAST_NAME.add("漫"); CN_LAST_NAME.add("本"); CN_LAST_NAME.add("圭"); CN_LAST_NAME.add("弭"); CN_LAST_NAME.add("眭"); CN_LAST_NAME.add("伯"); CN_LAST_NAME.add("朱"); CN_LAST_NAME.add("朴"); CN_LAST_NAME.add("强"); CN_LAST_NAME.add("机"); CN_LAST_NAME.add("似"); CN_LAST_NAME.add("权"); CN_LAST_NAME.add("但"); CN_LAST_NAME.add("位"); CN_LAST_NAME.add("李"); CN_LAST_NAME.add("齐"); CN_LAST_NAME.add("归"); CN_LAST_NAME.add("青"); CN_LAST_NAME.add("何"); CN_LAST_NAME.add("罕"); CN_LAST_NAME.add("靖"); CN_LAST_NAME.add("罗"); CN_LAST_NAME.add("潘"); CN_LAST_NAME.add("佘"); CN_LAST_NAME.add("余"); CN_LAST_NAME.add("坚"); CN_LAST_NAME.add("佛"); CN_LAST_NAME.add("潜"); CN_LAST_NAME.add("杜"); CN_LAST_NAME.add("杞"); CN_LAST_NAME.add("佟"); CN_LAST_NAME.add("束"); CN_LAST_NAME.add("睢"); CN_LAST_NAME.add("督"); CN_LAST_NAME.add("彤"); CN_LAST_NAME.add("来"); CN_LAST_NAME.add("车"); CN_LAST_NAME.add("睦"); CN_LAST_NAME.add("公孙"); CN_LAST_NAME.add("杨"); CN_LAST_NAME.add("革"); CN_LAST_NAME.add("亓官"); CN_LAST_NAME.add("彭"); CN_LAST_NAME.add("潭"); CN_LAST_NAME.add("杭"); CN_LAST_NAME.add("潮"); CN_LAST_NAME.add("诸葛"); CN_LAST_NAME.add("靳"); CN_LAST_NAME.add("佴"); CN_LAST_NAME.add("佼"); CN_LAST_NAME.add("载"); CN_LAST_NAME.add("松"); CN_LAST_NAME.add("板"); CN_LAST_NAME.add("澄"); CN_LAST_NAME.add("辉"); CN_LAST_NAME.add("皇甫"); CN_LAST_NAME.add("羊"); CN_LAST_NAME.add("律"); CN_LAST_NAME.add("融"); CN_LAST_NAME.add("侍"); CN_LAST_NAME.add("徐"); CN_LAST_NAME.add("析"); CN_LAST_NAME.add("林"); CN_LAST_NAME.add("龙"); CN_LAST_NAME.add("枚"); CN_LAST_NAME.add("龚"); CN_LAST_NAME.add("辛"); CN_LAST_NAME.add("辜"); CN_LAST_NAME.add("果"); CN_LAST_NAME.add("枝"); CN_LAST_NAME.add("依"); CN_LAST_NAME.add("辟"); CN_LAST_NAME.add("鞠"); CN_LAST_NAME.add("御"); CN_LAST_NAME.add("侨"); CN_LAST_NAME.add("徭"); CN_LAST_NAME.add("侯"); CN_LAST_NAME.add("德"); CN_LAST_NAME.add("边"); CN_LAST_NAME.add("羽"); CN_LAST_NAME.add("达"); CN_LAST_NAME.add("羿"); CN_LAST_NAME.add("瞿"); CN_LAST_NAME.add("翁"); CN_LAST_NAME.add("赫连"); CN_LAST_NAME.add("过"); CN_LAST_NAME.add("闾丘"); CN_LAST_NAME.add("城"); CN_LAST_NAME.add("俎"); CN_LAST_NAME.add("柏"); CN_LAST_NAME.add("运"); CN_LAST_NAME.add("柔"); CN_LAST_NAME.add("进"); CN_LAST_NAME.add("保"); CN_LAST_NAME.add("俞"); CN_LAST_NAME.add("连"); CN_LAST_NAME.add("俟"); CN_LAST_NAME.add("迟"); CN_LAST_NAME.add("翟"); CN_LAST_NAME.add("翠"); CN_LAST_NAME.add("太叔"); CN_LAST_NAME.add("信"); CN_LAST_NAME.add("欧阳"); CN_LAST_NAME.add("公叔"); CN_LAST_NAME.add("查"); CN_LAST_NAME.add("韦"); CN_LAST_NAME.add("翦"); CN_LAST_NAME.add("韩"); CN_LAST_NAME.add("矫"); CN_LAST_NAME.add("濮"); CN_LAST_NAME.add("修"); CN_LAST_NAME.add("迮"); CN_LAST_NAME.add("柯"); CN_LAST_NAME.add("濯"); CN_LAST_NAME.add("柳"); CN_LAST_NAME.add("石"); CN_LAST_NAME.add("柴"); CN_LAST_NAME.add("念"); CN_LAST_NAME.add("韶"); CN_LAST_NAME.add("忻"); } public static void initCN_FIRST_NAME() { CN_FIRST_NAME.add("慕雁"); CN_FIRST_NAME.add("婉然"); CN_FIRST_NAME.add("月明"); CN_FIRST_NAME.add("觅儿"); CN_FIRST_NAME.add("高翰"); CN_FIRST_NAME.add("白曼"); CN_FIRST_NAME.add("怀思"); CN_FIRST_NAME.add("碧菡"); CN_FIRST_NAME.add("奇邃"); CN_FIRST_NAME.add("云岚"); CN_FIRST_NAME.add("惜文"); CN_FIRST_NAME.add("夏青"); CN_FIRST_NAME.add("俊雄"); CN_FIRST_NAME.add("俊雅"); CN_FIRST_NAME.add("馨蓉"); CN_FIRST_NAME.add("庄丽"); CN_FIRST_NAME.add("笛韵"); CN_FIRST_NAME.add("笑天"); CN_FIRST_NAME.add("舒怀"); CN_FIRST_NAME.add("梦琪"); CN_FIRST_NAME.add("清润"); CN_FIRST_NAME.add("萦心"); CN_FIRST_NAME.add("丹蝶"); CN_FIRST_NAME.add("长旭"); CN_FIRST_NAME.add("清涵"); CN_FIRST_NAME.add("方仪"); CN_FIRST_NAME.add("杰秀"); CN_FIRST_NAME.add("天瑞"); CN_FIRST_NAME.add("美丽"); CN_FIRST_NAME.add("清淑"); CN_FIRST_NAME.add("忻愉"); CN_FIRST_NAME.add("隽美"); CN_FIRST_NAME.add("碧萱"); CN_FIRST_NAME.add("淑君"); CN_FIRST_NAME.add("诗兰"); CN_FIRST_NAME.add("平灵"); CN_FIRST_NAME.add("柔淑"); CN_FIRST_NAME.add("晓山"); CN_FIRST_NAME.add("乐蓉"); CN_FIRST_NAME.add("良哲"); CN_FIRST_NAME.add("永新"); CN_FIRST_NAME.add("凡阳"); CN_FIRST_NAME.add("莹洁"); CN_FIRST_NAME.add("哲圣"); CN_FIRST_NAME.add("同化"); CN_FIRST_NAME.add("玉英"); CN_FIRST_NAME.add("天和"); CN_FIRST_NAME.add("萦怀"); CN_FIRST_NAME.add("伟毅"); CN_FIRST_NAME.add("凝雁"); CN_FIRST_NAME.add("炎彬"); CN_FIRST_NAME.add("伟诚"); CN_FIRST_NAME.add("长星"); CN_FIRST_NAME.add("笑妍"); CN_FIRST_NAME.add("瀚海"); CN_FIRST_NAME.add("清一"); CN_FIRST_NAME.add("景天"); CN_FIRST_NAME.add("信瑞"); CN_FIRST_NAME.add("鸿雪"); CN_FIRST_NAME.add("子凡"); CN_FIRST_NAME.add("古韵"); CN_FIRST_NAME.add("志文"); CN_FIRST_NAME.add("凝雨"); CN_FIRST_NAME.add("凝雪"); CN_FIRST_NAME.add("萦思"); CN_FIRST_NAME.add("阳炎"); CN_FIRST_NAME.add("忆枫"); CN_FIRST_NAME.add("波光"); CN_FIRST_NAME.add("吉玉"); CN_FIRST_NAME.add("致萱"); CN_FIRST_NAME.add("博裕"); CN_FIRST_NAME.add("秀艾"); CN_FIRST_NAME.add("问风"); CN_FIRST_NAME.add("志新"); CN_FIRST_NAME.add("凡白"); CN_FIRST_NAME.add("忻慕"); CN_FIRST_NAME.add("正德"); CN_FIRST_NAME.add("芳泽"); CN_FIRST_NAME.add("吉玟"); CN_FIRST_NAME.add("秀艳"); CN_FIRST_NAME.add("芳洁"); CN_FIRST_NAME.add("白枫"); CN_FIRST_NAME.add("昆明"); CN_FIRST_NAME.add("忆柏"); CN_FIRST_NAME.add("辰骏"); CN_FIRST_NAME.add("水晶"); CN_FIRST_NAME.add("芳洲"); CN_FIRST_NAME.add("代卉"); CN_FIRST_NAME.add("菡梅"); CN_FIRST_NAME.add("正志"); CN_FIRST_NAME.add("琳溪"); CN_FIRST_NAME.add("叶嘉"); CN_FIRST_NAME.add("永昌"); CN_FIRST_NAME.add("曼衍"); CN_FIRST_NAME.add("书艺"); CN_FIRST_NAME.add("冰岚"); CN_FIRST_NAME.add("永春"); CN_FIRST_NAME.add("梅风"); CN_FIRST_NAME.add("柔丽"); CN_FIRST_NAME.add("元槐"); CN_FIRST_NAME.add("安歌"); CN_FIRST_NAME.add("子爱"); CN_FIRST_NAME.add("融雪"); CN_FIRST_NAME.add("涵韵"); CN_FIRST_NAME.add("香蝶"); CN_FIRST_NAME.add("倩语"); CN_FIRST_NAME.add("乐蕊"); CN_FIRST_NAME.add("康裕"); CN_FIRST_NAME.add("梓露"); CN_FIRST_NAME.add("昕葳"); CN_FIRST_NAME.add("问夏"); CN_FIRST_NAME.add("良畴"); CN_FIRST_NAME.add("毅君"); CN_FIRST_NAME.add("白柏"); CN_FIRST_NAME.add("彭勃"); CN_FIRST_NAME.add("迎真"); CN_FIRST_NAME.add("恨瑶"); CN_FIRST_NAME.add("月朗"); CN_FIRST_NAME.add("雨竹"); CN_FIRST_NAME.add("曼梅"); CN_FIRST_NAME.add("凡雁"); CN_FIRST_NAME.add("景福"); CN_FIRST_NAME.add("代玉"); CN_FIRST_NAME.add("碧蓉"); CN_FIRST_NAME.add("妙松"); CN_FIRST_NAME.add("童彤"); CN_FIRST_NAME.add("浩慨"); CN_FIRST_NAME.add("黎明"); CN_FIRST_NAME.add("黎昕"); CN_FIRST_NAME.add("友安"); CN_FIRST_NAME.add("驰海"); CN_FIRST_NAME.add("凝静"); CN_FIRST_NAME.add("飞鸣"); CN_FIRST_NAME.add("正思"); CN_FIRST_NAME.add("亦竹"); CN_FIRST_NAME.add("运盛"); CN_FIRST_NAME.add("易蓉"); CN_FIRST_NAME.add("芷波"); CN_FIRST_NAME.add("以南"); CN_FIRST_NAME.add("志明"); CN_FIRST_NAME.add("傲安"); CN_FIRST_NAME.add("蔓菁"); CN_FIRST_NAME.add("飞鹏"); CN_FIRST_NAME.add("春芳"); CN_FIRST_NAME.add("新烟"); CN_FIRST_NAME.add("绍晖"); CN_FIRST_NAME.add("凯唱"); CN_FIRST_NAME.add("振平"); CN_FIRST_NAME.add("雅彤"); CN_FIRST_NAME.add("虹颖"); CN_FIRST_NAME.add("从阳"); CN_FIRST_NAME.add("飞鸿"); CN_FIRST_NAME.add("飞鸾"); CN_FIRST_NAME.add("胤文"); CN_FIRST_NAME.add("帅红"); CN_FIRST_NAME.add("秀英"); CN_FIRST_NAME.add("代双"); CN_FIRST_NAME.add("芳润"); CN_FIRST_NAME.add("萱彤"); CN_FIRST_NAME.add("友容"); CN_FIRST_NAME.add("香柏"); CN_FIRST_NAME.add("夜雪"); CN_FIRST_NAME.add("凌香"); CN_FIRST_NAME.add("寻巧"); CN_FIRST_NAME.add("昊明"); CN_FIRST_NAME.add("莞然"); CN_FIRST_NAME.add("绮艳"); CN_FIRST_NAME.add("紫夏"); CN_FIRST_NAME.add("阳焱"); CN_FIRST_NAME.add("昊昊"); CN_FIRST_NAME.add("淑哲"); CN_FIRST_NAME.add("代珊"); CN_FIRST_NAME.add("月杉"); CN_FIRST_NAME.add("宜楠"); CN_FIRST_NAME.add("凡霜"); CN_FIRST_NAME.add("向卉"); CN_FIRST_NAME.add("今雨"); CN_FIRST_NAME.add("彦珺"); CN_FIRST_NAME.add("宵晨"); CN_FIRST_NAME.add("怀慕"); CN_FIRST_NAME.add("姝美"); CN_FIRST_NAME.add("合瑞"); CN_FIRST_NAME.add("妙柏"); CN_FIRST_NAME.add("芮丽"); CN_FIRST_NAME.add("春英"); CN_FIRST_NAME.add("白桃"); CN_FIRST_NAME.add("晋鹏"); CN_FIRST_NAME.add("锦凡"); CN_FIRST_NAME.add("香柳"); CN_FIRST_NAME.add("雨筠"); CN_FIRST_NAME.add("向南"); CN_FIRST_NAME.add("洋洋"); CN_FIRST_NAME.add("静涵"); CN_FIRST_NAME.add("尔竹"); CN_FIRST_NAME.add("献仪"); CN_FIRST_NAME.add("忆梅"); CN_FIRST_NAME.add("自明"); CN_FIRST_NAME.add("若枫"); CN_FIRST_NAME.add("问香"); CN_FIRST_NAME.add("雅美"); CN_FIRST_NAME.add("昭懿"); CN_FIRST_NAME.add("彦君"); CN_FIRST_NAME.add("阳煦"); CN_FIRST_NAME.add("小宸"); CN_FIRST_NAME.add("新儿"); CN_FIRST_NAME.add("青亦"); CN_FIRST_NAME.add("静淑"); CN_FIRST_NAME.add("娅童"); CN_FIRST_NAME.add("寄蓉"); CN_FIRST_NAME.add("阳兰"); CN_FIRST_NAME.add("以珊"); CN_FIRST_NAME.add("寄蓝"); CN_FIRST_NAME.add("明旭"); CN_FIRST_NAME.add("盼夏"); CN_FIRST_NAME.add("含灵"); CN_FIRST_NAME.add("雅志"); CN_FIRST_NAME.add("昂杰"); CN_FIRST_NAME.add("安民"); CN_FIRST_NAME.add("白梅"); CN_FIRST_NAME.add("熙怡"); CN_FIRST_NAME.add("靖之"); CN_FIRST_NAME.add("茉莉"); CN_FIRST_NAME.add("雨安"); CN_FIRST_NAME.add("伟泽"); CN_FIRST_NAME.add("琴轩"); CN_FIRST_NAME.add("倚云"); CN_FIRST_NAME.add("星菱"); CN_FIRST_NAME.add("平凡"); CN_FIRST_NAME.add("丁辰"); CN_FIRST_NAME.add("辰宇"); CN_FIRST_NAME.add("白梦"); CN_FIRST_NAME.add("清漪"); CN_FIRST_NAME.add("熠彤"); CN_FIRST_NAME.add("明明"); CN_FIRST_NAME.add("映菡"); CN_FIRST_NAME.add("阳冰"); CN_FIRST_NAME.add("从雪"); CN_FIRST_NAME.add("易文"); CN_FIRST_NAME.add("香桃"); CN_FIRST_NAME.add("映菱"); CN_FIRST_NAME.add("巍昂"); CN_FIRST_NAME.add("驰丽"); CN_FIRST_NAME.add("兰蕙"); CN_FIRST_NAME.add("振强"); CN_FIRST_NAME.add("锐锋"); CN_FIRST_NAME.add("红豆"); CN_FIRST_NAME.add("寒荷"); CN_FIRST_NAME.add("永望"); CN_FIRST_NAME.add("湛蓝"); CN_FIRST_NAME.add("新冬"); CN_FIRST_NAME.add("飞绿"); CN_FIRST_NAME.add("霏霏"); CN_FIRST_NAME.add("宵月"); CN_FIRST_NAME.add("春荷"); CN_FIRST_NAME.add("尔安"); CN_FIRST_NAME.add("清佳"); CN_FIRST_NAME.add("从霜"); CN_FIRST_NAME.add("田然"); CN_FIRST_NAME.add("同和"); CN_FIRST_NAME.add("盼香"); CN_FIRST_NAME.add("静丹"); CN_FIRST_NAME.add("雪容"); CN_FIRST_NAME.add("映萱"); CN_FIRST_NAME.add("宏毅"); CN_FIRST_NAME.add("含烟"); CN_FIRST_NAME.add("香梅"); CN_FIRST_NAME.add("明智"); CN_FIRST_NAME.add("醉芙"); CN_FIRST_NAME.add("昆杰"); CN_FIRST_NAME.add("妙梦"); CN_FIRST_NAME.add("痴香"); CN_FIRST_NAME.add("尔容"); CN_FIRST_NAME.add("从露"); CN_FIRST_NAME.add("幻儿"); CN_FIRST_NAME.add("山灵"); CN_FIRST_NAME.add("笑笑"); CN_FIRST_NAME.add("优乐"); CN_FIRST_NAME.add("寄蕾"); CN_FIRST_NAME.add("令璟"); CN_FIRST_NAME.add("慧雅"); CN_FIRST_NAME.add("高懿"); CN_FIRST_NAME.add("皎月"); CN_FIRST_NAME.add("月桂"); CN_FIRST_NAME.add("月桃"); CN_FIRST_NAME.add("和蔼"); CN_FIRST_NAME.add("芮优"); CN_FIRST_NAME.add("冰巧"); CN_FIRST_NAME.add("韵宁"); CN_FIRST_NAME.add("古香"); CN_FIRST_NAME.add("盼秋"); CN_FIRST_NAME.add("秋芸"); CN_FIRST_NAME.add("谷枫"); CN_FIRST_NAME.add("秋芳"); CN_FIRST_NAME.add("寄文"); CN_FIRST_NAME.add("瀚漠"); CN_FIRST_NAME.add("静云"); CN_FIRST_NAME.add("泰然"); CN_FIRST_NAME.add("俊风"); CN_FIRST_NAME.add("碧春"); CN_FIRST_NAME.add("灵萱"); CN_FIRST_NAME.add("恬畅"); CN_FIRST_NAME.add("英朗"); CN_FIRST_NAME.add("芝兰"); CN_FIRST_NAME.add("悦乐"); CN_FIRST_NAME.add("清俊"); CN_FIRST_NAME.add("飞龙"); CN_FIRST_NAME.add("光誉"); CN_FIRST_NAME.add("鸿飞"); CN_FIRST_NAME.add("梓颖"); CN_FIRST_NAME.add("寻绿"); CN_FIRST_NAME.add("蔓蔓"); CN_FIRST_NAME.add("安波"); CN_FIRST_NAME.add("沛容"); CN_FIRST_NAME.add("子珍"); CN_FIRST_NAME.add("燕妮"); CN_FIRST_NAME.add("巧荷"); CN_FIRST_NAME.add("鸿风"); CN_FIRST_NAME.add("朝旭"); CN_FIRST_NAME.add("听然"); CN_FIRST_NAME.add("书萱"); CN_FIRST_NAME.add("韫素"); CN_FIRST_NAME.add("孤兰"); CN_FIRST_NAME.add("高扬"); CN_FIRST_NAME.add("元武"); CN_FIRST_NAME.add("秋英"); CN_FIRST_NAME.add("元正"); CN_FIRST_NAME.add("舒扬"); CN_FIRST_NAME.add("飞羽"); CN_FIRST_NAME.add("英杰"); CN_FIRST_NAME.add("韶容"); CN_FIRST_NAME.add("君博"); CN_FIRST_NAME.add("芮佳"); CN_FIRST_NAME.add("同甫"); CN_FIRST_NAME.add("桂芝"); CN_FIRST_NAME.add("兴文"); CN_FIRST_NAME.add("飞翔"); CN_FIRST_NAME.add("姝惠"); CN_FIRST_NAME.add("雅惠"); CN_FIRST_NAME.add("芷云"); CN_FIRST_NAME.add("美偲"); CN_FIRST_NAME.add("昕昕"); CN_FIRST_NAME.add("令锋"); CN_FIRST_NAME.add("振翱"); CN_FIRST_NAME.add("耘志"); CN_FIRST_NAME.add("初然"); CN_FIRST_NAME.add("羡丽"); CN_FIRST_NAME.add("怀芹"); CN_FIRST_NAME.add("觅双"); CN_FIRST_NAME.add("觅珍"); CN_FIRST_NAME.add("芮澜"); CN_FIRST_NAME.add("文静"); CN_FIRST_NAME.add("飞翰"); CN_FIRST_NAME.add("诗珊"); CN_FIRST_NAME.add("飞翮"); CN_FIRST_NAME.add("诗双"); CN_FIRST_NAME.add("明朗"); CN_FIRST_NAME.add("高芬"); CN_FIRST_NAME.add("笑容"); CN_FIRST_NAME.add("意致"); CN_FIRST_NAME.add("飞翼"); CN_FIRST_NAME.add("子琪"); CN_FIRST_NAME.add("哲妍"); CN_FIRST_NAME.add("希彤"); CN_FIRST_NAME.add("悦人"); CN_FIRST_NAME.add("华池"); CN_FIRST_NAME.add("皓月"); CN_FIRST_NAME.add("蕴秀"); CN_FIRST_NAME.add("清逸"); CN_FIRST_NAME.add("芸溪"); CN_FIRST_NAME.add("语儿"); CN_FIRST_NAME.add("宁乐"); CN_FIRST_NAME.add("子琳"); CN_FIRST_NAME.add("寄春"); CN_FIRST_NAME.add("驰轩"); CN_FIRST_NAME.add("思彤"); CN_FIRST_NAME.add("笑寒"); CN_FIRST_NAME.add("秋荣"); CN_FIRST_NAME.add("初兰"); CN_FIRST_NAME.add("婉君"); CN_FIRST_NAME.add("嘉石"); CN_FIRST_NAME.add("嘉音"); CN_FIRST_NAME.add("森丽"); CN_FIRST_NAME.add("鸿祯"); CN_FIRST_NAME.add("秋荷"); CN_FIRST_NAME.add("子瑜"); CN_FIRST_NAME.add("迎天"); CN_FIRST_NAME.add("绣文"); CN_FIRST_NAME.add("兴旺"); CN_FIRST_NAME.add("宜欣"); CN_FIRST_NAME.add("梦雨"); CN_FIRST_NAME.add("迎夏"); CN_FIRST_NAME.add("兴昌"); CN_FIRST_NAME.add("翠曼"); CN_FIRST_NAME.add("山兰"); CN_FIRST_NAME.add("浩荡"); CN_FIRST_NAME.add("施然"); CN_FIRST_NAME.add("淑雅"); CN_FIRST_NAME.add("娴雅"); CN_FIRST_NAME.add("燕婉"); CN_FIRST_NAME.add("思美"); CN_FIRST_NAME.add("天真"); CN_FIRST_NAME.add("问筠"); CN_FIRST_NAME.add("烨霖"); CN_FIRST_NAME.add("泰初"); CN_FIRST_NAME.add("和昶"); CN_FIRST_NAME.add("鸿福"); CN_FIRST_NAME.add("乐松"); CN_FIRST_NAME.add("雍恬"); CN_FIRST_NAME.add("明杰"); CN_FIRST_NAME.add("好洁"); CN_FIRST_NAME.add("越彬"); CN_FIRST_NAME.add("锐阵"); CN_FIRST_NAME.add("碧曼"); CN_FIRST_NAME.add("沛山"); CN_FIRST_NAME.add("格菲"); CN_FIRST_NAME.add("子璇"); CN_FIRST_NAME.add("平卉"); CN_FIRST_NAME.add("倩丽"); CN_FIRST_NAME.add("琬凝"); CN_FIRST_NAME.add("文石"); CN_FIRST_NAME.add("梦露"); CN_FIRST_NAME.add("天青"); CN_FIRST_NAME.add("星文"); CN_FIRST_NAME.add("冰绿"); CN_FIRST_NAME.add("娟妍"); CN_FIRST_NAME.add("惜梦"); CN_FIRST_NAME.add("怜翠"); CN_FIRST_NAME.add("秋莲"); CN_FIRST_NAME.add("承嗣"); CN_FIRST_NAME.add("濡霈"); CN_FIRST_NAME.add("奇玮"); CN_FIRST_NAME.add("之桃"); CN_FIRST_NAME.add("德水"); CN_FIRST_NAME.add("建茗"); CN_FIRST_NAME.add("沛岚"); CN_FIRST_NAME.add("妍歌"); CN_FIRST_NAME.add("雪峰"); CN_FIRST_NAME.add("成荫"); CN_FIRST_NAME.add("志行"); CN_FIRST_NAME.add("云心"); CN_FIRST_NAME.add("鸿禧"); CN_FIRST_NAME.add("谷梦"); CN_FIRST_NAME.add("卿月"); CN_FIRST_NAME.add("阳华"); CN_FIRST_NAME.add("和暄"); CN_FIRST_NAME.add("语冰"); CN_FIRST_NAME.add("梓馨"); CN_FIRST_NAME.add("范明"); CN_FIRST_NAME.add("天睿"); CN_FIRST_NAME.add("晓彤"); CN_FIRST_NAME.add("霞雰"); CN_FIRST_NAME.add("秀敏"); CN_FIRST_NAME.add("和暖"); CN_FIRST_NAME.add("舒荣"); CN_FIRST_NAME.add("暄妍"); CN_FIRST_NAME.add("丁兰"); CN_FIRST_NAME.add("夜天"); CN_FIRST_NAME.add("娟秀"); CN_FIRST_NAME.add("娜娜"); CN_FIRST_NAME.add("凌寒"); CN_FIRST_NAME.add("茜茜"); CN_FIRST_NAME.add("兰月"); CN_FIRST_NAME.add("悠逸"); CN_FIRST_NAME.add("语燕"); CN_FIRST_NAME.add("骊泓"); CN_FIRST_NAME.add("依美"); CN_FIRST_NAME.add("昕月"); CN_FIRST_NAME.add("宏浚"); CN_FIRST_NAME.add("叶飞"); CN_FIRST_NAME.add("骊洁"); CN_FIRST_NAME.add("淑静"); CN_FIRST_NAME.add("嘉颖"); CN_FIRST_NAME.add("思怡"); CN_FIRST_NAME.add("轩昂"); CN_FIRST_NAME.add("如波"); CN_FIRST_NAME.add("迎秋"); CN_FIRST_NAME.add("思思"); CN_FIRST_NAME.add("琛瑞"); CN_FIRST_NAME.add("娴静"); CN_FIRST_NAME.add("紫安"); CN_FIRST_NAME.add("恩霈"); CN_FIRST_NAME.add("问寒"); CN_FIRST_NAME.add("恨真"); CN_FIRST_NAME.add("冰彦"); CN_FIRST_NAME.add("怀莲"); CN_FIRST_NAME.add("雅懿"); CN_FIRST_NAME.add("千亦"); CN_FIRST_NAME.add("运馨"); CN_FIRST_NAME.add("依心"); CN_FIRST_NAME.add("恬雅"); CN_FIRST_NAME.add("希恩"); CN_FIRST_NAME.add("俨雅"); CN_FIRST_NAME.add("驰逸"); CN_FIRST_NAME.add("雅致"); CN_FIRST_NAME.add("青烟"); CN_FIRST_NAME.add("翠柏"); CN_FIRST_NAME.add("思恩"); CN_FIRST_NAME.add("天音"); CN_FIRST_NAME.add("思聪"); CN_FIRST_NAME.add("寒蕾"); CN_FIRST_NAME.add("天韵"); CN_FIRST_NAME.add("书文"); CN_FIRST_NAME.add("一凡"); CN_FIRST_NAME.add("雁芙"); CN_FIRST_NAME.add("娟娟"); CN_FIRST_NAME.add("星星"); CN_FIRST_NAME.add("俊驰"); CN_FIRST_NAME.add("静逸"); CN_FIRST_NAME.add("景山"); CN_FIRST_NAME.add("春蕾"); CN_FIRST_NAME.add("夜香"); CN_FIRST_NAME.add("悦远"); CN_FIRST_NAME.add("碧螺"); CN_FIRST_NAME.add("宜民"); CN_FIRST_NAME.add("健柏"); CN_FIRST_NAME.add("慧颖"); CN_FIRST_NAME.add("彤雯"); CN_FIRST_NAME.add("亦巧"); CN_FIRST_NAME.add("文墨"); CN_FIRST_NAME.add("燕子"); CN_FIRST_NAME.add("冰心"); CN_FIRST_NAME.add("翰藻"); CN_FIRST_NAME.add("星晖"); CN_FIRST_NAME.add("柔煦"); CN_FIRST_NAME.add("红云"); CN_FIRST_NAME.add("兴朝"); CN_FIRST_NAME.add("念蕾"); CN_FIRST_NAME.add("国安"); CN_FIRST_NAME.add("睿识"); CN_FIRST_NAME.add("曦之"); CN_FIRST_NAME.add("德泽"); CN_FIRST_NAME.add("鸿骞"); CN_FIRST_NAME.add("雪巧"); CN_FIRST_NAME.add("寄松"); CN_FIRST_NAME.add("睿诚"); CN_FIRST_NAME.add("仙韵"); CN_FIRST_NAME.add("彤霞"); CN_FIRST_NAME.add("星晴"); CN_FIRST_NAME.add("姝艳"); CN_FIRST_NAME.add("又绿"); CN_FIRST_NAME.add("念文"); CN_FIRST_NAME.add("智宇"); CN_FIRST_NAME.add("聪睿"); CN_FIRST_NAME.add("元洲"); CN_FIRST_NAME.add("巧蕊"); CN_FIRST_NAME.add("向阳"); CN_FIRST_NAME.add("梓婷"); CN_FIRST_NAME.add("宏深"); CN_FIRST_NAME.add("欢欣"); CN_FIRST_NAME.add("雪帆"); CN_FIRST_NAME.add("泰华"); CN_FIRST_NAME.add("蔚星"); CN_FIRST_NAME.add("绮文"); CN_FIRST_NAME.add("斯琪"); CN_FIRST_NAME.add("雅艳"); CN_FIRST_NAME.add("恬静"); CN_FIRST_NAME.add("书易"); CN_FIRST_NAME.add("幻玉"); CN_FIRST_NAME.add("谷槐"); CN_FIRST_NAME.add("琦珍"); CN_FIRST_NAME.add("琪华"); CN_FIRST_NAME.add("翠桃"); CN_FIRST_NAME.add("欣欣"); CN_FIRST_NAME.add("平和"); CN_FIRST_NAME.add("智宸"); CN_FIRST_NAME.add("嘉祥"); CN_FIRST_NAME.add("曼语"); CN_FIRST_NAME.add("鹏飞"); CN_FIRST_NAME.add("华清"); CN_FIRST_NAME.add("佳文"); CN_FIRST_NAME.add("暄婷"); CN_FIRST_NAME.add("彦露"); CN_FIRST_NAME.add("夏容"); CN_FIRST_NAME.add("玮艺"); CN_FIRST_NAME.add("心语"); CN_FIRST_NAME.add("嘉祯"); CN_FIRST_NAME.add("令雪"); CN_FIRST_NAME.add("莹然"); CN_FIRST_NAME.add("宏义"); CN_FIRST_NAME.add("孟君"); CN_FIRST_NAME.add("沈思"); CN_FIRST_NAME.add("心诺"); CN_FIRST_NAME.add("寄柔"); CN_FIRST_NAME.add("修雅"); CN_FIRST_NAME.add("茂材"); CN_FIRST_NAME.add("英楠"); CN_FIRST_NAME.add("畅然"); CN_FIRST_NAME.add("听南"); CN_FIRST_NAME.add("敏思"); CN_FIRST_NAME.add("幻珊"); CN_FIRST_NAME.add("夏寒"); CN_FIRST_NAME.add("晨希"); CN_FIRST_NAME.add("鹏天"); CN_FIRST_NAME.add("怡悦"); CN_FIRST_NAME.add("涵容"); CN_FIRST_NAME.add("晴岚"); CN_FIRST_NAME.add("翠梅"); CN_FIRST_NAME.add("嘉福"); CN_FIRST_NAME.add("德海"); CN_FIRST_NAME.add("运骏"); CN_FIRST_NAME.add("含玉"); CN_FIRST_NAME.add("嘉禧"); CN_FIRST_NAME.add("凯风"); CN_FIRST_NAME.add("凝竹"); CN_FIRST_NAME.add("靖儿"); CN_FIRST_NAME.add("学博"); CN_FIRST_NAME.add("梓童"); CN_FIRST_NAME.add("海荣"); CN_FIRST_NAME.add("春晓"); CN_FIRST_NAME.add("希慕"); CN_FIRST_NAME.add("竹悦"); CN_FIRST_NAME.add("德润"); CN_FIRST_NAME.add("雁荷"); CN_FIRST_NAME.add("幼珊"); CN_FIRST_NAME.add("永言"); CN_FIRST_NAME.add("良奥"); CN_FIRST_NAME.add("华乐"); CN_FIRST_NAME.add("新瑶"); CN_FIRST_NAME.add("初南"); CN_FIRST_NAME.add("贝丽"); CN_FIRST_NAME.add("暄嫣"); CN_FIRST_NAME.add("向雁"); CN_FIRST_NAME.add("春晖"); CN_FIRST_NAME.add("心水"); CN_FIRST_NAME.add("甘雨"); CN_FIRST_NAME.add("嘉禾"); CN_FIRST_NAME.add("思慧"); CN_FIRST_NAME.add("烨磊"); CN_FIRST_NAME.add("之槐"); CN_FIRST_NAME.add("向雪"); CN_FIRST_NAME.add("凯复"); CN_FIRST_NAME.add("奇略"); CN_FIRST_NAME.add("修真"); CN_FIRST_NAME.add("访风"); CN_FIRST_NAME.add("端懿"); CN_FIRST_NAME.add("易梦"); CN_FIRST_NAME.add("季同"); CN_FIRST_NAME.add("如之"); CN_FIRST_NAME.add("佩杉"); CN_FIRST_NAME.add("含双"); CN_FIRST_NAME.add("飞舟"); CN_FIRST_NAME.add("康泰"); CN_FIRST_NAME.add("亦绿"); CN_FIRST_NAME.add("逸丽"); CN_FIRST_NAME.add("巧春"); CN_FIRST_NAME.add("芷烟"); CN_FIRST_NAME.add("彩静"); CN_FIRST_NAME.add("宇达"); CN_FIRST_NAME.add("飞航"); CN_FIRST_NAME.add("向真"); CN_FIRST_NAME.add("听双"); CN_FIRST_NAME.add("鸿宝"); CN_FIRST_NAME.add("光济"); CN_FIRST_NAME.add("海莹"); CN_FIRST_NAME.add("曜灿"); CN_FIRST_NAME.add("秀曼"); CN_FIRST_NAME.add("咸英"); CN_FIRST_NAME.add("慧秀"); CN_FIRST_NAME.add("安澜"); CN_FIRST_NAME.add("琨瑜"); CN_FIRST_NAME.add("文姝"); CN_FIRST_NAME.add("兰梦"); CN_FIRST_NAME.add("贤淑"); CN_FIRST_NAME.add("琨瑶"); CN_FIRST_NAME.add("雁菱"); CN_FIRST_NAME.add("如云"); CN_FIRST_NAME.add("珺娅"); CN_FIRST_NAME.add("凝安"); CN_FIRST_NAME.add("海菡"); CN_FIRST_NAME.add("雪绿"); CN_FIRST_NAME.add("逸云"); CN_FIRST_NAME.add("德业"); CN_FIRST_NAME.add("光赫"); CN_FIRST_NAME.add("夏山"); CN_FIRST_NAME.add("绮晴"); CN_FIRST_NAME.add("乃欣"); CN_FIRST_NAME.add("奕叶"); CN_FIRST_NAME.add("向露"); CN_FIRST_NAME.add("博赡"); CN_FIRST_NAME.add("温书"); CN_FIRST_NAME.add("涵山"); CN_FIRST_NAME.add("雁菡"); CN_FIRST_NAME.add("承基"); CN_FIRST_NAME.add("初珍"); CN_FIRST_NAME.add("访天"); CN_FIRST_NAME.add("飞扬"); CN_FIRST_NAME.add("一南"); CN_FIRST_NAME.add("佳晨"); CN_FIRST_NAME.add("夏岚"); CN_FIRST_NAME.add("博超"); CN_FIRST_NAME.add("瑞渊"); CN_FIRST_NAME.add("博涉"); CN_FIRST_NAME.add("恨风"); CN_FIRST_NAME.add("燕岚"); CN_FIRST_NAME.add("邵美"); CN_FIRST_NAME.add("学名"); CN_FIRST_NAME.add("雨彤"); CN_FIRST_NAME.add("天禄"); CN_FIRST_NAME.add("怀蕾"); CN_FIRST_NAME.add("广君"); CN_FIRST_NAME.add("晓慧"); CN_FIRST_NAME.add("德义"); CN_FIRST_NAME.add("成文"); CN_FIRST_NAME.add("宏伟"); CN_FIRST_NAME.add("蒙雨"); CN_FIRST_NAME.add("云臻"); CN_FIRST_NAME.add("洋然"); CN_FIRST_NAME.add("芷兰"); CN_FIRST_NAME.add("琬琰"); CN_FIRST_NAME.add("博涛"); CN_FIRST_NAME.add("宏伯"); CN_FIRST_NAME.add("怀薇"); CN_FIRST_NAME.add("思懿"); CN_FIRST_NAME.add("美华"); CN_FIRST_NAME.add("鹏程"); CN_FIRST_NAME.add("泰和"); CN_FIRST_NAME.add("霞飞"); CN_FIRST_NAME.add("婷然"); CN_FIRST_NAME.add("芸儿"); CN_FIRST_NAME.add("微澜"); CN_FIRST_NAME.add("浩旷"); CN_FIRST_NAME.add("如仪"); CN_FIRST_NAME.add("绿蓉"); CN_FIRST_NAME.add("玉树"); CN_FIRST_NAME.add("灵松"); CN_FIRST_NAME.add("翰林"); CN_FIRST_NAME.add("昭昭"); CN_FIRST_NAME.add("逸仙"); CN_FIRST_NAME.add("慕山"); CN_FIRST_NAME.add("溥心"); CN_FIRST_NAME.add("秋春"); CN_FIRST_NAME.add("醉易"); CN_FIRST_NAME.add("小翠"); CN_FIRST_NAME.add("梦香"); CN_FIRST_NAME.add("秀杰"); CN_FIRST_NAME.add("飞英"); CN_FIRST_NAME.add("元亮"); CN_FIRST_NAME.add("慧婕"); CN_FIRST_NAME.add("旭东"); CN_FIRST_NAME.add("和裕"); CN_FIRST_NAME.add("子真"); CN_FIRST_NAME.add("牧歌"); CN_FIRST_NAME.add("洮洮"); CN_FIRST_NAME.add("弘致"); CN_FIRST_NAME.add("北嘉"); CN_FIRST_NAME.add("灵枫"); CN_FIRST_NAME.add("书蝶"); CN_FIRST_NAME.add("清卓"); CN_FIRST_NAME.add("清华"); CN_FIRST_NAME.add("艳娇"); CN_FIRST_NAME.add("寒松"); CN_FIRST_NAME.add("梦秋"); CN_FIRST_NAME.add("景平"); CN_FIRST_NAME.add("宛丝"); CN_FIRST_NAME.add("弘懿"); CN_FIRST_NAME.add("曜儿"); CN_FIRST_NAME.add("华辉"); CN_FIRST_NAME.add("芸熙"); CN_FIRST_NAME.add("承颜"); CN_FIRST_NAME.add("琰琬"); CN_FIRST_NAME.add("初瑶"); CN_FIRST_NAME.add("敏慧"); CN_FIRST_NAME.add("暮雨"); CN_FIRST_NAME.add("舒方"); CN_FIRST_NAME.add("雅萍"); CN_FIRST_NAME.add("辰龙"); CN_FIRST_NAME.add("瑞云"); CN_FIRST_NAME.add("巧曼"); CN_FIRST_NAME.add("君雅"); CN_FIRST_NAME.add("光临"); CN_FIRST_NAME.add("雪羽"); CN_FIRST_NAME.add("宏达"); CN_FIRST_NAME.add("良骥"); CN_FIRST_NAME.add("采绿"); CN_FIRST_NAME.add("暖姝"); CN_FIRST_NAME.add("骞泽"); CN_FIRST_NAME.add("田田"); CN_FIRST_NAME.add("爰爰"); CN_FIRST_NAME.add("伟兆"); CN_FIRST_NAME.add("良骏"); CN_FIRST_NAME.add("易槐"); CN_FIRST_NAME.add("寻芳"); CN_FIRST_NAME.add("芫华"); CN_FIRST_NAME.add("寻芹"); CN_FIRST_NAME.add("献玉"); CN_FIRST_NAME.add("米琪"); CN_FIRST_NAME.add("振荣"); CN_FIRST_NAME.add("觅露"); CN_FIRST_NAME.add("绣梓"); CN_FIRST_NAME.add("绿蕊"); CN_FIRST_NAME.add("阳嘉"); CN_FIRST_NAME.add("高明"); CN_FIRST_NAME.add("宏远"); CN_FIRST_NAME.add("家欣"); CN_FIRST_NAME.add("博丽"); CN_FIRST_NAME.add("春枫"); CN_FIRST_NAME.add("知慧"); CN_FIRST_NAME.add("高旻"); CN_FIRST_NAME.add("诗霜"); CN_FIRST_NAME.add("安邦"); CN_FIRST_NAME.add("雪翎"); CN_FIRST_NAME.add("高昂"); CN_FIRST_NAME.add("雁蓉"); CN_FIRST_NAME.add("婉静"); CN_FIRST_NAME.add("立果"); CN_FIRST_NAME.add("春柔"); CN_FIRST_NAME.add("春柏"); CN_FIRST_NAME.add("悦爱"); CN_FIRST_NAME.add("意蕴"); CN_FIRST_NAME.add("沙羽"); CN_FIRST_NAME.add("飞荷"); CN_FIRST_NAME.add("韶美"); CN_FIRST_NAME.add("海蓝"); CN_FIRST_NAME.add("飞捷"); CN_FIRST_NAME.add("真如"); CN_FIRST_NAME.add("远骞"); CN_FIRST_NAME.add("千儿"); CN_FIRST_NAME.add("从筠"); CN_FIRST_NAME.add("妍丽"); CN_FIRST_NAME.add("建明"); CN_FIRST_NAME.add("弘扬"); CN_FIRST_NAME.add("宛亦"); CN_FIRST_NAME.add("棠华"); CN_FIRST_NAME.add("骏伟"); CN_FIRST_NAME.add("思若"); CN_FIRST_NAME.add("令飒"); CN_FIRST_NAME.add("盼巧"); CN_FIRST_NAME.add("馨欣"); CN_FIRST_NAME.add("丽泽"); CN_FIRST_NAME.add("霞姝"); CN_FIRST_NAME.add("天骄"); CN_FIRST_NAME.add("德佑"); CN_FIRST_NAME.add("阳阳"); CN_FIRST_NAME.add("从安"); CN_FIRST_NAME.add("康乐"); CN_FIRST_NAME.add("念柏"); CN_FIRST_NAME.add("一瑾"); CN_FIRST_NAME.add("经武"); CN_FIRST_NAME.add("天空"); CN_FIRST_NAME.add("香波"); CN_FIRST_NAME.add("宏逸"); CN_FIRST_NAME.add("英武"); CN_FIRST_NAME.add("承天"); CN_FIRST_NAME.add("琳瑜"); CN_FIRST_NAME.add("飞莲"); CN_FIRST_NAME.add("正文"); CN_FIRST_NAME.add("云英"); CN_FIRST_NAME.add("金鹏"); CN_FIRST_NAME.add("一璇"); CN_FIRST_NAME.add("光亮"); CN_FIRST_NAME.add("秋月"); CN_FIRST_NAME.add("书桃"); CN_FIRST_NAME.add("淑婉"); CN_FIRST_NAME.add("宜人"); CN_FIRST_NAME.add("飞掣"); CN_FIRST_NAME.add("淑穆"); CN_FIRST_NAME.add("天媛"); CN_FIRST_NAME.add("香洁"); CN_FIRST_NAME.add("琼华"); CN_FIRST_NAME.add("娴婉"); CN_FIRST_NAME.add("绿旋"); CN_FIRST_NAME.add("洁玉"); CN_FIRST_NAME.add("莹华"); CN_FIRST_NAME.add("子石"); CN_FIRST_NAME.add("代天"); CN_FIRST_NAME.add("梅红"); CN_FIRST_NAME.add("茵茵"); CN_FIRST_NAME.add("春桃"); CN_FIRST_NAME.add("娅思"); CN_FIRST_NAME.add("思茵"); CN_FIRST_NAME.add("洛灵"); CN_FIRST_NAME.add("平雅"); CN_FIRST_NAME.add("嘉宝"); CN_FIRST_NAME.add("德辉"); CN_FIRST_NAME.add("嘉实"); CN_FIRST_NAME.add("孟阳"); CN_FIRST_NAME.add("瀚玥"); CN_FIRST_NAME.add("安然"); CN_FIRST_NAME.add("昆谊"); CN_FIRST_NAME.add("伶伶"); CN_FIRST_NAME.add("秀梅"); CN_FIRST_NAME.add("曼丽"); CN_FIRST_NAME.add("宏邈"); CN_FIRST_NAME.add("敏才"); CN_FIRST_NAME.add("良策"); CN_FIRST_NAME.add("乐欣"); CN_FIRST_NAME.add("嘉容"); CN_FIRST_NAME.add("琲瓃"); CN_FIRST_NAME.add("半烟"); CN_FIRST_NAME.add("笑翠"); CN_FIRST_NAME.add("莹玉"); CN_FIRST_NAME.add("念桃"); CN_FIRST_NAME.add("英毅"); CN_FIRST_NAME.add("芳华"); CN_FIRST_NAME.add("仙媛"); CN_FIRST_NAME.add("景彰"); CN_FIRST_NAME.add("志诚"); CN_FIRST_NAME.add("素怀"); CN_FIRST_NAME.add("千凝"); CN_FIRST_NAME.add("怀曼"); CN_FIRST_NAME.add("文宣"); CN_FIRST_NAME.add("祺然"); CN_FIRST_NAME.add("千凡"); CN_FIRST_NAME.add("德运"); CN_FIRST_NAME.add("寒梅"); CN_FIRST_NAME.add("斯雅"); CN_FIRST_NAME.add("华灿"); CN_FIRST_NAME.add("承福"); CN_FIRST_NAME.add("音悦"); CN_FIRST_NAME.add("秋蝶"); CN_FIRST_NAME.add("兴言"); CN_FIRST_NAME.add("景龙"); CN_FIRST_NAME.add("骏俊"); CN_FIRST_NAME.add("桂月"); CN_FIRST_NAME.add("春梅"); CN_FIRST_NAME.add("欣跃"); CN_FIRST_NAME.add("平露"); CN_FIRST_NAME.add("曼云"); CN_FIRST_NAME.add("新雅"); CN_FIRST_NAME.add("乐正"); CN_FIRST_NAME.add("梦竹"); CN_FIRST_NAME.add("寒梦"); CN_FIRST_NAME.add("醉蝶"); CN_FIRST_NAME.add("丹丹"); CN_FIRST_NAME.add("高朗"); CN_FIRST_NAME.add("思莹"); CN_FIRST_NAME.add("旭辉"); CN_FIRST_NAME.add("新雨"); CN_FIRST_NAME.add("新雪"); CN_FIRST_NAME.add("雅蕊"); CN_FIRST_NAME.add("忆丹"); CN_FIRST_NAME.add("思莲"); CN_FIRST_NAME.add("阳霁"); CN_FIRST_NAME.add("淳雅"); CN_FIRST_NAME.add("代秋"); CN_FIRST_NAME.add("孤阳"); CN_FIRST_NAME.add("意智"); CN_FIRST_NAME.add("稷骞"); CN_FIRST_NAME.add("寻菡"); CN_FIRST_NAME.add("忆之"); CN_FIRST_NAME.add("卓逸"); CN_FIRST_NAME.add("彩妍"); CN_FIRST_NAME.add("庆生"); CN_FIRST_NAME.add("伶俐"); CN_FIRST_NAME.add("子墨"); CN_FIRST_NAME.add("康伯"); CN_FIRST_NAME.add("绮梅"); CN_FIRST_NAME.add("寻菱"); CN_FIRST_NAME.add("念梦"); CN_FIRST_NAME.add("新霁"); CN_FIRST_NAME.add("苇然"); CN_FIRST_NAME.add("雁易"); CN_FIRST_NAME.add("建木"); CN_FIRST_NAME.add("秋柔"); CN_FIRST_NAME.add("宏儒"); CN_FIRST_NAME.add("光辉"); CN_FIRST_NAME.add("秋柏"); CN_FIRST_NAME.add("半兰"); CN_FIRST_NAME.add("令秋"); CN_FIRST_NAME.add("凯安"); CN_FIRST_NAME.add("丹云"); CN_FIRST_NAME.add("天宇"); CN_FIRST_NAME.add("绮梦"); CN_FIRST_NAME.add("慈心"); CN_FIRST_NAME.add("思菱"); CN_FIRST_NAME.add("海昌"); CN_FIRST_NAME.add("建本"); CN_FIRST_NAME.add("智纯"); CN_FIRST_NAME.add("名姝"); CN_FIRST_NAME.add("莹琇"); CN_FIRST_NAME.add("明诚"); CN_FIRST_NAME.add("凯定"); CN_FIRST_NAME.add("静珊"); CN_FIRST_NAME.add("思萌"); CN_FIRST_NAME.add("丹亦"); CN_FIRST_NAME.add("彭祖"); CN_FIRST_NAME.add("靖琪"); CN_FIRST_NAME.add("秋柳"); CN_FIRST_NAME.add("英豪"); CN_FIRST_NAME.add("幼白"); CN_FIRST_NAME.add("高杰"); CN_FIRST_NAME.add("冬莲"); CN_FIRST_NAME.add("格格"); CN_FIRST_NAME.add("任真"); CN_FIRST_NAME.add("晴美"); CN_FIRST_NAME.add("乐语"); CN_FIRST_NAME.add("丹溪"); CN_FIRST_NAME.add("元灵"); CN_FIRST_NAME.add("醉柳"); CN_FIRST_NAME.add("晓莉"); CN_FIRST_NAME.add("骏逸"); CN_FIRST_NAME.add("若淑"); CN_FIRST_NAME.add("恨竹"); CN_FIRST_NAME.add("凌翠"); CN_FIRST_NAME.add("娟巧"); CN_FIRST_NAME.add("桂枫"); CN_FIRST_NAME.add("萧曼"); CN_FIRST_NAME.add("熙星"); CN_FIRST_NAME.add("锐立"); CN_FIRST_NAME.add("博达"); CN_FIRST_NAME.add("梦安"); CN_FIRST_NAME.add("雅旋"); CN_FIRST_NAME.add("思萱"); CN_FIRST_NAME.add("觅风"); CN_FIRST_NAME.add("光远"); CN_FIRST_NAME.add("白云"); CN_FIRST_NAME.add("初阳"); CN_FIRST_NAME.add("致欣"); CN_FIRST_NAME.add("香之"); CN_FIRST_NAME.add("文山"); CN_FIRST_NAME.add("白亦"); CN_FIRST_NAME.add("微熹"); CN_FIRST_NAME.add("博远"); CN_FIRST_NAME.add("季雅"); CN_FIRST_NAME.add("淳静"); CN_FIRST_NAME.add("漾漾"); CN_FIRST_NAME.add("冬菱"); CN_FIRST_NAME.add("向秋"); CN_FIRST_NAME.add("麦冬"); CN_FIRST_NAME.add("婀娜"); CN_FIRST_NAME.add("怀柔"); CN_FIRST_NAME.add("瀚钰"); CN_FIRST_NAME.add("妙之"); CN_FIRST_NAME.add("宜修"); CN_FIRST_NAME.add("瑞灵"); CN_FIRST_NAME.add("半凡"); CN_FIRST_NAME.add("梦容"); CN_FIRST_NAME.add("梦寒"); CN_FIRST_NAME.add("芷珊"); CN_FIRST_NAME.add("骞仕"); CN_FIRST_NAME.add("芷珍"); CN_FIRST_NAME.add("永贞"); CN_FIRST_NAME.add("乐水"); CN_FIRST_NAME.add("灵槐"); CN_FIRST_NAME.add("婷玉"); CN_FIRST_NAME.add("觅夏"); CN_FIRST_NAME.add("含雁"); CN_FIRST_NAME.add("一嘉"); CN_FIRST_NAME.add("虹彩"); CN_FIRST_NAME.add("韦茹"); CN_FIRST_NAME.add("雅昶"); CN_FIRST_NAME.add("冰莹"); CN_FIRST_NAME.add("悦可"); CN_FIRST_NAME.add("虹影"); CN_FIRST_NAME.add("博瀚"); CN_FIRST_NAME.add("令婧"); CN_FIRST_NAME.add("志泽"); CN_FIRST_NAME.add("冬萱"); CN_FIRST_NAME.add("睿达"); CN_FIRST_NAME.add("伟博"); CN_FIRST_NAME.add("惜海"); CN_FIRST_NAME.add("乐池"); CN_FIRST_NAME.add("幻露"); CN_FIRST_NAME.add("开朗"); CN_FIRST_NAME.add("建柏"); CN_FIRST_NAME.add("方雅"); CN_FIRST_NAME.add("雅晗"); CN_FIRST_NAME.add("奇颖"); CN_FIRST_NAME.add("康适"); CN_FIRST_NAME.add("婉奕"); CN_FIRST_NAME.add("凡巧"); CN_FIRST_NAME.add("幼霜"); CN_FIRST_NAME.add("曼辞"); CN_FIRST_NAME.add("天籁"); CN_FIRST_NAME.add("华采"); CN_FIRST_NAME.add("优瑗"); CN_FIRST_NAME.add("希蓉"); CN_FIRST_NAME.add("新知"); CN_FIRST_NAME.add("皎洁"); CN_FIRST_NAME.add("依萱"); CN_FIRST_NAME.add("夏彤"); CN_FIRST_NAME.add("静和"); CN_FIRST_NAME.add("景胜"); CN_FIRST_NAME.add("芷琪"); CN_FIRST_NAME.add("卓然"); CN_FIRST_NAME.add("和歌"); CN_FIRST_NAME.add("怿悦"); CN_FIRST_NAME.add("冰菱"); CN_FIRST_NAME.add("旭炎"); CN_FIRST_NAME.add("怀桃"); CN_FIRST_NAME.add("端敏"); CN_FIRST_NAME.add("鹏鲲"); CN_FIRST_NAME.add("经赋"); CN_FIRST_NAME.add("瑜然"); CN_FIRST_NAME.add("竹萱"); CN_FIRST_NAME.add("绿蝶"); CN_FIRST_NAME.add("智美"); CN_FIRST_NAME.add("鹏鲸"); CN_FIRST_NAME.add("若云"); CN_FIRST_NAME.add("建树"); CN_FIRST_NAME.add("和正"); CN_FIRST_NAME.add("如冬"); CN_FIRST_NAME.add("南烟"); CN_FIRST_NAME.add("英资"); CN_FIRST_NAME.add("如冰"); CN_FIRST_NAME.add("恨寒"); CN_FIRST_NAME.add("初雪"); CN_FIRST_NAME.add("德元"); CN_FIRST_NAME.add("盼翠"); CN_FIRST_NAME.add("运鹏"); CN_FIRST_NAME.add("蕙芸"); CN_FIRST_NAME.add("学真"); CN_FIRST_NAME.add("心远"); CN_FIRST_NAME.add("高格"); CN_FIRST_NAME.add("谧辰"); CN_FIRST_NAME.add("飞薇"); CN_FIRST_NAME.add("山雁"); CN_FIRST_NAME.add("飞文"); CN_FIRST_NAME.add("运鸿"); CN_FIRST_NAME.add("荷紫"); CN_FIRST_NAME.add("宏爽"); CN_FIRST_NAME.add("康健"); CN_FIRST_NAME.add("梦山"); CN_FIRST_NAME.add("水丹"); CN_FIRST_NAME.add("蕴美"); CN_FIRST_NAME.add("语雪"); CN_FIRST_NAME.add("听露"); CN_FIRST_NAME.add("智志"); CN_FIRST_NAME.add("朋义"); CN_FIRST_NAME.add("如凡"); CN_FIRST_NAME.add("咏歌"); CN_FIRST_NAME.add("骊燕"); CN_FIRST_NAME.add("水之"); CN_FIRST_NAME.add("琪睿"); CN_FIRST_NAME.add("婉秀"); CN_FIRST_NAME.add("云蔚"); CN_FIRST_NAME.add("忆辰"); CN_FIRST_NAME.add("鹤骞"); CN_FIRST_NAME.add("清嘉"); CN_FIRST_NAME.add("冷荷"); CN_FIRST_NAME.add("悦和"); CN_FIRST_NAME.add("怀梦"); CN_FIRST_NAME.add("畅畅"); CN_FIRST_NAME.add("辰良"); CN_FIRST_NAME.add("涵忍"); CN_FIRST_NAME.add("俊弼"); CN_FIRST_NAME.add("梦岚"); CN_FIRST_NAME.add("蕙若"); CN_FIRST_NAME.add("哲彦"); CN_FIRST_NAME.add("绿柏"); CN_FIRST_NAME.add("明洁"); CN_FIRST_NAME.add("初露"); CN_FIRST_NAME.add("皓洁"); CN_FIRST_NAME.add("腾骏"); CN_FIRST_NAME.add("修竹"); CN_FIRST_NAME.add("元冬"); CN_FIRST_NAME.add("凝绿"); CN_FIRST_NAME.add("庄雅"); CN_FIRST_NAME.add("杉月"); CN_FIRST_NAME.add("菊华"); CN_FIRST_NAME.add("哲美"); CN_FIRST_NAME.add("俊彦"); CN_FIRST_NAME.add("米雪"); CN_FIRST_NAME.add("叶帆"); CN_FIRST_NAME.add("忆远"); CN_FIRST_NAME.add("雪艳"); CN_FIRST_NAME.add("绿柳"); CN_FIRST_NAME.add("乐贤"); CN_FIRST_NAME.add("思敏"); CN_FIRST_NAME.add("丽佳"); CN_FIRST_NAME.add("又莲"); CN_FIRST_NAME.add("谷之"); CN_FIRST_NAME.add("一雯"); CN_FIRST_NAME.add("安南"); CN_FIRST_NAME.add("晓蓝"); CN_FIRST_NAME.add("承安"); CN_FIRST_NAME.add("阳飇"); CN_FIRST_NAME.add("新颖"); CN_FIRST_NAME.add("安卉"); CN_FIRST_NAME.add("礼骞"); CN_FIRST_NAME.add("腾骞"); CN_FIRST_NAME.add("永丰"); CN_FIRST_NAME.add("飞昂"); CN_FIRST_NAME.add("婉娜"); CN_FIRST_NAME.add("海融"); CN_FIRST_NAME.add("元凯"); CN_FIRST_NAME.add("承宣"); CN_FIRST_NAME.add("俊美"); CN_FIRST_NAME.add("尔芙"); CN_FIRST_NAME.add("曜瑞"); CN_FIRST_NAME.add("宛儿"); CN_FIRST_NAME.add("冷菱"); CN_FIRST_NAME.add("骞信"); CN_FIRST_NAME.add("宜然"); CN_FIRST_NAME.add("以筠"); CN_FIRST_NAME.add("流丽"); CN_FIRST_NAME.add("纳兰"); CN_FIRST_NAME.add("又菡"); CN_FIRST_NAME.add("飞星"); CN_FIRST_NAME.add("阳飙"); CN_FIRST_NAME.add("芦雪"); CN_FIRST_NAME.add("志专"); CN_FIRST_NAME.add("千叶"); CN_FIRST_NAME.add("鸿彩"); CN_FIRST_NAME.add("力行"); CN_FIRST_NAME.add("向笛"); CN_FIRST_NAME.add("飞虎"); CN_FIRST_NAME.add("经业"); CN_FIRST_NAME.add("濮存"); CN_FIRST_NAME.add("冰蓝"); CN_FIRST_NAME.add("俊德"); CN_FIRST_NAME.add("志业"); CN_FIRST_NAME.add("庆雪"); CN_FIRST_NAME.add("谷云"); CN_FIRST_NAME.add("湉湉"); CN_FIRST_NAME.add("阳夏"); CN_FIRST_NAME.add("骏燕"); CN_FIRST_NAME.add("修筠"); CN_FIRST_NAME.add("琴雪"); CN_FIRST_NAME.add("梓彤"); CN_FIRST_NAME.add("代容"); CN_FIRST_NAME.add("鸿羲"); CN_FIRST_NAME.add("林帆"); CN_FIRST_NAME.add("娅芳"); CN_FIRST_NAME.add("子骞"); CN_FIRST_NAME.add("良工"); CN_FIRST_NAME.add("迎彤"); CN_FIRST_NAME.add("鸿德"); CN_FIRST_NAME.add("鸿羽"); CN_FIRST_NAME.add("冷萱"); CN_FIRST_NAME.add("惠丽"); CN_FIRST_NAME.add("悦畅"); CN_FIRST_NAME.add("熙柔"); CN_FIRST_NAME.add("和豫"); CN_FIRST_NAME.add("经义"); CN_FIRST_NAME.add("梓美"); CN_FIRST_NAME.add("庄静"); CN_FIRST_NAME.add("志义"); CN_FIRST_NAME.add("昊东"); CN_FIRST_NAME.add("丰熙"); CN_FIRST_NAME.add("哲思"); CN_FIRST_NAME.add("忆灵"); CN_FIRST_NAME.add("弘文"); CN_FIRST_NAME.add("慕思"); CN_FIRST_NAME.add("傲菡"); CN_FIRST_NAME.add("安双"); CN_FIRST_NAME.add("夜绿"); CN_FIRST_NAME.add("安珊"); CN_FIRST_NAME.add("鸿志"); CN_FIRST_NAME.add("慧巧"); CN_FIRST_NAME.add("清雅"); CN_FIRST_NAME.add("荏苒"); CN_FIRST_NAME.add("沛芹"); CN_FIRST_NAME.add("光熙"); CN_FIRST_NAME.add("彭魄"); CN_FIRST_NAME.add("昌淼"); CN_FIRST_NAME.add("柔雅"); CN_FIRST_NAME.add("茹薇"); CN_FIRST_NAME.add("依薇"); CN_FIRST_NAME.add("嘉平"); CN_FIRST_NAME.add("嘉年"); CN_FIRST_NAME.add("寻春"); CN_FIRST_NAME.add("以寒"); CN_FIRST_NAME.add("泽雨"); CN_FIRST_NAME.add("暄美"); CN_FIRST_NAME.add("晓蕾"); CN_FIRST_NAME.add("兰泽"); CN_FIRST_NAME.add("友菱"); CN_FIRST_NAME.add("凝心"); CN_FIRST_NAME.add("涵育"); CN_FIRST_NAME.add("荌荌"); CN_FIRST_NAME.add("清霁"); CN_FIRST_NAME.add("陶然"); CN_FIRST_NAME.add("弘新"); CN_FIRST_NAME.add("寄波"); CN_FIRST_NAME.add("俏美"); CN_FIRST_NAME.add("嘉庆"); CN_FIRST_NAME.add("勇捷"); CN_FIRST_NAME.add("红叶"); CN_FIRST_NAME.add("孟夏"); CN_FIRST_NAME.add("子童"); CN_FIRST_NAME.add("宏博"); CN_FIRST_NAME.add("丝琦"); CN_FIRST_NAME.add("海桃"); CN_FIRST_NAME.add("丝琪"); CN_FIRST_NAME.add("经亘"); CN_FIRST_NAME.add("沛若"); CN_FIRST_NAME.add("宛凝"); CN_FIRST_NAME.add("弘方"); CN_FIRST_NAME.add("安吉"); CN_FIRST_NAME.add("之云"); CN_FIRST_NAME.add("雁桃"); CN_FIRST_NAME.add("君婷"); CN_FIRST_NAME.add("锦程"); CN_FIRST_NAME.add("雅柏"); CN_FIRST_NAME.add("昊乾"); CN_FIRST_NAME.add("悦喜"); CN_FIRST_NAME.add("浩言"); CN_FIRST_NAME.add("锐精"); CN_FIRST_NAME.add("雅柔"); CN_FIRST_NAME.add("可心"); CN_FIRST_NAME.add("嘉纳"); CN_FIRST_NAME.add("才艺"); CN_FIRST_NAME.add("芮雅"); CN_FIRST_NAME.add("半双"); CN_FIRST_NAME.add("青雪"); CN_FIRST_NAME.add("安琪"); CN_FIRST_NAME.add("鹏鹍"); CN_FIRST_NAME.add("才良"); CN_FIRST_NAME.add("丹烟"); CN_FIRST_NAME.add("怜晴"); CN_FIRST_NAME.add("晓旋"); CN_FIRST_NAME.add("小萍"); CN_FIRST_NAME.add("天巧"); CN_FIRST_NAME.add("天工"); CN_FIRST_NAME.add("雨莲"); CN_FIRST_NAME.add("冰薇"); CN_FIRST_NAME.add("晗蕊"); CN_FIRST_NAME.add("孤风"); CN_FIRST_NAME.add("乐游"); CN_FIRST_NAME.add("元勋"); CN_FIRST_NAME.add("洁雅"); CN_FIRST_NAME.add("阳秋"); CN_FIRST_NAME.add("凝思"); CN_FIRST_NAME.add("冬易"); CN_FIRST_NAME.add("和泰"); CN_FIRST_NAME.add("莹白"); CN_FIRST_NAME.add("良平"); CN_FIRST_NAME.add("雁梅"); CN_FIRST_NAME.add("涵意"); CN_FIRST_NAME.add("和泽"); CN_FIRST_NAME.add("慕悦"); CN_FIRST_NAME.add("乐湛"); CN_FIRST_NAME.add("幻天"); CN_FIRST_NAME.add("星汉"); CN_FIRST_NAME.add("柔静"); CN_FIRST_NAME.add("朗丽"); CN_FIRST_NAME.add("晗蕾"); CN_FIRST_NAME.add("奥雅"); CN_FIRST_NAME.add("雪莲"); CN_FIRST_NAME.add("文康"); CN_FIRST_NAME.add("如南"); CN_FIRST_NAME.add("又蓝"); CN_FIRST_NAME.add("俊悟"); CN_FIRST_NAME.add("佁然"); CN_FIRST_NAME.add("若灵"); CN_FIRST_NAME.add("晓星"); CN_FIRST_NAME.add("长运"); CN_FIRST_NAME.add("叶彤"); CN_FIRST_NAME.add("安和"); CN_FIRST_NAME.add("悠雅"); CN_FIRST_NAME.add("祺瑞"); CN_FIRST_NAME.add("晓昕"); CN_FIRST_NAME.add("驰皓"); CN_FIRST_NAME.add("琴音"); CN_FIRST_NAME.add("翠丝"); CN_FIRST_NAME.add("子安"); CN_FIRST_NAME.add("元化"); CN_FIRST_NAME.add("兴贤"); CN_FIRST_NAME.add("子宁"); CN_FIRST_NAME.add("和洽"); CN_FIRST_NAME.add("曼冬"); CN_FIRST_NAME.add("忆然"); CN_FIRST_NAME.add("平婉"); CN_FIRST_NAME.add("子实"); CN_FIRST_NAME.add("启颜"); CN_FIRST_NAME.add("多思"); CN_FIRST_NAME.add("才英"); CN_FIRST_NAME.add("书语"); CN_FIRST_NAME.add("琴韵"); CN_FIRST_NAME.add("绍辉"); CN_FIRST_NAME.add("静白"); CN_FIRST_NAME.add("昊伟"); CN_FIRST_NAME.add("齐心"); CN_FIRST_NAME.add("立诚"); CN_FIRST_NAME.add("月灵"); CN_FIRST_NAME.add("依晨"); CN_FIRST_NAME.add("天干"); CN_FIRST_NAME.add("晗日"); CN_FIRST_NAME.add("乐人"); CN_FIRST_NAME.add("坚白"); CN_FIRST_NAME.add("曼凡"); CN_FIRST_NAME.add("驰雪"); CN_FIRST_NAME.add("明亮"); CN_FIRST_NAME.add("曼凝"); CN_FIRST_NAME.add("玉泉"); CN_FIRST_NAME.add("信鸥"); CN_FIRST_NAME.add("雪萍"); CN_FIRST_NAME.add("幻香"); CN_FIRST_NAME.add("飞松"); CN_FIRST_NAME.add("信鸿"); CN_FIRST_NAME.add("洁静"); CN_FIRST_NAME.add("希月"); CN_FIRST_NAME.add("诗筠"); CN_FIRST_NAME.add("星河"); CN_FIRST_NAME.add("罗绮"); CN_FIRST_NAME.add("问芙"); CN_FIRST_NAME.add("俊能"); CN_FIRST_NAME.add("芮静"); CN_FIRST_NAME.add("德华"); CN_FIRST_NAME.add("欣然"); CN_FIRST_NAME.add("翰池"); CN_FIRST_NAME.add("晨菲"); CN_FIRST_NAME.add("向山"); CN_FIRST_NAME.add("长逸"); CN_FIRST_NAME.add("忻欢"); CN_FIRST_NAME.add("晔晔"); CN_FIRST_NAME.add("语风"); CN_FIRST_NAME.add("运恒"); CN_FIRST_NAME.add("佑运"); CN_FIRST_NAME.add("初夏"); CN_FIRST_NAME.add("玉泽"); CN_FIRST_NAME.add("婉容"); CN_FIRST_NAME.add("清韵"); CN_FIRST_NAME.add("静雅"); CN_FIRST_NAME.add("凯康"); CN_FIRST_NAME.add("飞柏"); CN_FIRST_NAME.add("天纵"); CN_FIRST_NAME.add("奕奕"); CN_FIRST_NAME.add("嘉美"); CN_FIRST_NAME.add("星波"); CN_FIRST_NAME.add("星泽"); CN_FIRST_NAME.add("文彦"); CN_FIRST_NAME.add("颐然"); CN_FIRST_NAME.add("晗昱"); CN_FIRST_NAME.add("苑博"); CN_FIRST_NAME.add("良弼"); CN_FIRST_NAME.add("曦哲"); CN_FIRST_NAME.add("梅花"); CN_FIRST_NAME.add("含香"); CN_FIRST_NAME.add("嘉德"); CN_FIRST_NAME.add("晨萱"); CN_FIRST_NAME.add("才捷"); CN_FIRST_NAME.add("德厚"); CN_FIRST_NAME.add("文彬"); CN_FIRST_NAME.add("布衣"); CN_FIRST_NAME.add("炫明"); CN_FIRST_NAME.add("映波"); CN_FIRST_NAME.add("力言"); CN_FIRST_NAME.add("易云"); CN_FIRST_NAME.add("作人"); CN_FIRST_NAME.add("俊慧"); CN_FIRST_NAME.add("采莲"); CN_FIRST_NAME.add("沛萍"); CN_FIRST_NAME.add("嘉志"); CN_FIRST_NAME.add("燕舞"); CN_FIRST_NAME.add("葛菲"); CN_FIRST_NAME.add("星津"); CN_FIRST_NAME.add("晗晗"); CN_FIRST_NAME.add("卿云"); CN_FIRST_NAME.add("英达"); CN_FIRST_NAME.add("含秀"); CN_FIRST_NAME.add("星洲"); CN_FIRST_NAME.add("梅英"); CN_FIRST_NAME.add("灵波"); CN_FIRST_NAME.add("芷雪"); CN_FIRST_NAME.add("晓曼"); CN_FIRST_NAME.add("敏智"); CN_FIRST_NAME.add("白凡"); CN_FIRST_NAME.add("怡月"); CN_FIRST_NAME.add("慧美"); CN_FIRST_NAME.add("思松"); CN_FIRST_NAME.add("永逸"); CN_FIRST_NAME.add("白凝"); CN_FIRST_NAME.add("浩歌"); CN_FIRST_NAME.add("玄清"); CN_FIRST_NAME.add("文心"); CN_FIRST_NAME.add("小蕊"); CN_FIRST_NAME.add("盼芙"); CN_FIRST_NAME.add("笑萍"); CN_FIRST_NAME.add("惜灵"); CN_FIRST_NAME.add("明轩"); CN_FIRST_NAME.add("新立"); CN_FIRST_NAME.add("吉帆"); CN_FIRST_NAME.add("流逸"); CN_FIRST_NAME.add("文德"); CN_FIRST_NAME.add("傲薇"); CN_FIRST_NAME.add("会雯"); CN_FIRST_NAME.add("竹月"); CN_FIRST_NAME.add("思枫"); CN_FIRST_NAME.add("卓君"); CN_FIRST_NAME.add("雅楠"); CN_FIRST_NAME.add("怡木"); CN_FIRST_NAME.add("兴业"); CN_FIRST_NAME.add("光华"); CN_FIRST_NAME.add("慧心"); CN_FIRST_NAME.add("双文"); CN_FIRST_NAME.add("嘉怡"); CN_FIRST_NAME.add("湘云"); CN_FIRST_NAME.add("星海"); CN_FIRST_NAME.add("含娇"); CN_FIRST_NAME.add("明辉"); CN_FIRST_NAME.add("皓轩"); CN_FIRST_NAME.add("琼音"); CN_FIRST_NAME.add("若兰"); CN_FIRST_NAME.add("瑛琭"); CN_FIRST_NAME.add("尔蓉"); CN_FIRST_NAME.add("尔蓝"); CN_FIRST_NAME.add("小蕾"); CN_FIRST_NAME.add("文翰"); CN_FIRST_NAME.add("新竹"); CN_FIRST_NAME.add("寄云"); CN_FIRST_NAME.add("兴为"); CN_FIRST_NAME.add("楚楚"); CN_FIRST_NAME.add("秀洁"); CN_FIRST_NAME.add("傲旋"); CN_FIRST_NAME.add("天罡"); CN_FIRST_NAME.add("文耀"); CN_FIRST_NAME.add("采萱"); CN_FIRST_NAME.add("思柔"); CN_FIRST_NAME.add("南珍"); CN_FIRST_NAME.add("觅山"); CN_FIRST_NAME.add("温瑜"); CN_FIRST_NAME.add("平宁"); CN_FIRST_NAME.add("晨蓓"); CN_FIRST_NAME.add("高歌"); CN_FIRST_NAME.add("莺韵"); CN_FIRST_NAME.add("代巧"); CN_FIRST_NAME.add("明俊"); CN_FIRST_NAME.add("良翰"); CN_FIRST_NAME.add("颖然"); CN_FIRST_NAME.add("瑛瑶"); CN_FIRST_NAME.add("英逸"); CN_FIRST_NAME.add("昂然"); CN_FIRST_NAME.add("文思"); CN_FIRST_NAME.add("胤运"); CN_FIRST_NAME.add("明达"); CN_FIRST_NAME.add("平安"); CN_FIRST_NAME.add("溪蓝"); CN_FIRST_NAME.add("骏琛"); CN_FIRST_NAME.add("明远"); CN_FIRST_NAME.add("霞绮"); CN_FIRST_NAME.add("馨逸"); CN_FIRST_NAME.add("水儿"); CN_FIRST_NAME.add("梦影"); CN_FIRST_NAME.add("翰海"); CN_FIRST_NAME.add("虹英"); CN_FIRST_NAME.add("博厚"); CN_FIRST_NAME.add("雨文"); CN_FIRST_NAME.add("晶茹"); CN_FIRST_NAME.add("访彤"); CN_FIRST_NAME.add("筠竹"); CN_FIRST_NAME.add("元瑶"); CN_FIRST_NAME.add("宏畅"); CN_FIRST_NAME.add("鹏翼"); CN_FIRST_NAME.add("友易"); CN_FIRST_NAME.add("寻桃"); CN_FIRST_NAME.add("又晴"); CN_FIRST_NAME.add("傲易"); CN_FIRST_NAME.add("沛蓝"); CN_FIRST_NAME.add("芸静"); CN_FIRST_NAME.add("天心"); CN_FIRST_NAME.add("晓枫"); CN_FIRST_NAME.add("睿博"); CN_FIRST_NAME.add("一禾"); CN_FIRST_NAME.add("嘉悦"); CN_FIRST_NAME.add("南琴"); CN_FIRST_NAME.add("绮波"); CN_FIRST_NAME.add("美如"); CN_FIRST_NAME.add("新筠"); CN_FIRST_NAME.add("安阳"); CN_FIRST_NAME.add("曼卉"); CN_FIRST_NAME.add("霁芸"); CN_FIRST_NAME.add("朋兴"); CN_FIRST_NAME.add("秀越"); CN_FIRST_NAME.add("浩气"); CN_FIRST_NAME.add("星渊"); CN_FIRST_NAME.add("长兴"); CN_FIRST_NAME.add("俊才"); CN_FIRST_NAME.add("冰蝶"); CN_FIRST_NAME.add("问萍"); CN_FIRST_NAME.add("瑜璟"); CN_FIRST_NAME.add("典丽"); CN_FIRST_NAME.add("梓舒"); CN_FIRST_NAME.add("千雁"); CN_FIRST_NAME.add("幻竹"); CN_FIRST_NAME.add("承平"); CN_FIRST_NAME.add("昂熙"); CN_FIRST_NAME.add("依柔"); CN_FIRST_NAME.add("韦曲"); CN_FIRST_NAME.add("恬默"); CN_FIRST_NAME.add("寻梅"); CN_FIRST_NAME.add("乐逸"); CN_FIRST_NAME.add("采蓝"); CN_FIRST_NAME.add("亦旋"); CN_FIRST_NAME.add("天翰"); CN_FIRST_NAME.add("清奇"); CN_FIRST_NAME.add("俊良"); CN_FIRST_NAME.add("惜儿"); CN_FIRST_NAME.add("彦红"); CN_FIRST_NAME.add("雨旋"); CN_FIRST_NAME.add("冰枫"); CN_FIRST_NAME.add("玉书"); CN_FIRST_NAME.add("水冬"); CN_FIRST_NAME.add("嘉胜"); CN_FIRST_NAME.add("小星"); CN_FIRST_NAME.add("嘉惠"); CN_FIRST_NAME.add("小春"); CN_FIRST_NAME.add("鸿才"); CN_FIRST_NAME.add("俊艾"); CN_FIRST_NAME.add("春海"); CN_FIRST_NAME.add("菱凡"); CN_FIRST_NAME.add("霞影"); CN_FIRST_NAME.add("曜坤"); CN_FIRST_NAME.add("永元"); CN_FIRST_NAME.add("傲晴"); CN_FIRST_NAME.add("谷兰"); CN_FIRST_NAME.add("韶敏"); CN_FIRST_NAME.add("光启"); CN_FIRST_NAME.add("楠楠"); CN_FIRST_NAME.add("绍元"); CN_FIRST_NAME.add("安白"); CN_FIRST_NAME.add("水凡"); CN_FIRST_NAME.add("高谊"); CN_FIRST_NAME.add("清妍"); CN_FIRST_NAME.add("雨星"); CN_FIRST_NAME.add("莞尔"); CN_FIRST_NAME.add("紫菱"); CN_FIRST_NAME.add("骞北"); CN_FIRST_NAME.add("小晨"); CN_FIRST_NAME.add("文惠"); CN_FIRST_NAME.add("蓉城"); CN_FIRST_NAME.add("驰颖"); CN_FIRST_NAME.add("丹南"); CN_FIRST_NAME.add("清妙"); CN_FIRST_NAME.add("云梦"); CN_FIRST_NAME.add("俊拔"); CN_FIRST_NAME.add("沛文"); CN_FIRST_NAME.add("元甲"); CN_FIRST_NAME.add("柔妙"); CN_FIRST_NAME.add("紫萍"); CN_FIRST_NAME.add("清馨"); CN_FIRST_NAME.add("修平"); CN_FIRST_NAME.add("骏哲"); CN_FIRST_NAME.add("理群"); CN_FIRST_NAME.add("晓桐"); CN_FIRST_NAME.add("冬梅"); CN_FIRST_NAME.add("波峻"); CN_FIRST_NAME.add("颖初"); CN_FIRST_NAME.add("凝芙"); CN_FIRST_NAME.add("忆南"); CN_FIRST_NAME.add("浦泽"); CN_FIRST_NAME.add("惠然"); CN_FIRST_NAME.add("哲茂"); CN_FIRST_NAME.add("远悦"); CN_FIRST_NAME.add("乐邦"); CN_FIRST_NAME.add("曼珍"); CN_FIRST_NAME.add("昊然"); CN_FIRST_NAME.add("丝雨"); CN_FIRST_NAME.add("白卉"); CN_FIRST_NAME.add("嘉慕"); CN_FIRST_NAME.add("曼珠"); CN_FIRST_NAME.add("英光"); CN_FIRST_NAME.add("紫萱"); CN_FIRST_NAME.add("芬馥"); CN_FIRST_NAME.add("清秋"); CN_FIRST_NAME.add("天恩"); CN_FIRST_NAME.add("醉波"); CN_FIRST_NAME.add("昊焱"); CN_FIRST_NAME.add("俊英"); CN_FIRST_NAME.add("宏阔"); CN_FIRST_NAME.add("秀丽"); CN_FIRST_NAME.add("俊茂"); CN_FIRST_NAME.add("致远"); CN_FIRST_NAME.add("幼安"); CN_FIRST_NAME.add("瑞锦"); CN_FIRST_NAME.add("红雪"); CN_FIRST_NAME.add("晨旭"); CN_FIRST_NAME.add("彤彤"); CN_FIRST_NAME.add("合美"); CN_FIRST_NAME.add("运良"); CN_FIRST_NAME.add("展鹏"); CN_FIRST_NAME.add("承弼"); CN_FIRST_NAME.add("雨晨"); CN_FIRST_NAME.add("浩波"); CN_FIRST_NAME.add("妍和"); CN_FIRST_NAME.add("青香"); CN_FIRST_NAME.add("世韵"); CN_FIRST_NAME.add("天悦"); CN_FIRST_NAME.add("芝宇"); CN_FIRST_NAME.add("泰宁"); CN_FIRST_NAME.add("雨晴"); CN_FIRST_NAME.add("安国"); CN_FIRST_NAME.add("飞槐"); CN_FIRST_NAME.add("碧灵"); CN_FIRST_NAME.add("白玉"); CN_FIRST_NAME.add("坚壁"); CN_FIRST_NAME.add("冷松"); CN_FIRST_NAME.add("恬美"); CN_FIRST_NAME.add("曼吟"); CN_FIRST_NAME.add("采薇"); CN_FIRST_NAME.add("采文"); CN_FIRST_NAME.add("鸣晨"); CN_FIRST_NAME.add("丽华"); CN_FIRST_NAME.add("夏菡"); CN_FIRST_NAME.add("悠奕"); CN_FIRST_NAME.add("晨星"); CN_FIRST_NAME.add("智菱"); CN_FIRST_NAME.add("韦柔"); CN_FIRST_NAME.add("又松"); CN_FIRST_NAME.add("子帆"); CN_FIRST_NAME.add("听筠"); CN_FIRST_NAME.add("涵菡"); CN_FIRST_NAME.add("香卉"); CN_FIRST_NAME.add("安露"); CN_FIRST_NAME.add("鸿振"); CN_FIRST_NAME.add("骏喆"); CN_FIRST_NAME.add("歌云"); CN_FIRST_NAME.add("音景"); CN_FIRST_NAME.add("涵菱"); CN_FIRST_NAME.add("童欣"); CN_FIRST_NAME.add("笑旋"); CN_FIRST_NAME.add("锐志"); CN_FIRST_NAME.add("开诚"); CN_FIRST_NAME.add("兴运"); CN_FIRST_NAME.add("听安"); CN_FIRST_NAME.add("雪晴"); CN_FIRST_NAME.add("馨兰"); CN_FIRST_NAME.add("正诚"); CN_FIRST_NAME.add("灵溪"); CN_FIRST_NAME.add("桐欣"); CN_FIRST_NAME.add("孤容"); CN_FIRST_NAME.add("曾琪"); CN_FIRST_NAME.add("书云"); CN_FIRST_NAME.add("安青"); CN_FIRST_NAME.add("叶舞"); CN_FIRST_NAME.add("丽玉"); CN_FIRST_NAME.add("乐儿"); CN_FIRST_NAME.add("沛春"); CN_FIRST_NAME.add("三姗"); CN_FIRST_NAME.add("俊捷"); CN_FIRST_NAME.add("清婉"); CN_FIRST_NAME.add("半雪"); CN_FIRST_NAME.add("乐然"); CN_FIRST_NAME.add("思楠"); CN_FIRST_NAME.add("兴修"); CN_FIRST_NAME.add("锐翰"); CN_FIRST_NAME.add("朗然"); CN_FIRST_NAME.add("寒云"); CN_FIRST_NAME.add("柔婉"); CN_FIRST_NAME.add("素昕"); CN_FIRST_NAME.add("安静"); CN_FIRST_NAME.add("念之"); CN_FIRST_NAME.add("绮丽"); CN_FIRST_NAME.add("宛畅"); CN_FIRST_NAME.add("嘉致"); CN_FIRST_NAME.add("巍然"); CN_FIRST_NAME.add("若南"); CN_FIRST_NAME.add("悠馨"); CN_FIRST_NAME.add("和通"); CN_FIRST_NAME.add("又柔"); CN_FIRST_NAME.add("傲松"); CN_FIRST_NAME.add("夏萱"); CN_FIRST_NAME.add("正谊"); CN_FIRST_NAME.add("问蕊"); CN_FIRST_NAME.add("玉轩"); CN_FIRST_NAME.add("华皓"); CN_FIRST_NAME.add("湘灵"); CN_FIRST_NAME.add("丹琴"); CN_FIRST_NAME.add("明煦"); CN_FIRST_NAME.add("承德"); CN_FIRST_NAME.add("以彤"); CN_FIRST_NAME.add("若华"); CN_FIRST_NAME.add("嘉懿"); CN_FIRST_NAME.add("锐思"); CN_FIRST_NAME.add("令美"); CN_FIRST_NAME.add("欣可"); CN_FIRST_NAME.add("淑惠"); CN_FIRST_NAME.add("宏盛"); CN_FIRST_NAME.add("子平"); CN_FIRST_NAME.add("修齐"); CN_FIRST_NAME.add("元嘉"); CN_FIRST_NAME.add("采春"); CN_FIRST_NAME.add("浩浩"); CN_FIRST_NAME.add("凝荷"); CN_FIRST_NAME.add("浩涆"); CN_FIRST_NAME.add("瑰玮"); CN_FIRST_NAME.add("凌文"); CN_FIRST_NAME.add("成济"); CN_FIRST_NAME.add("承志"); CN_FIRST_NAME.add("雅歌"); CN_FIRST_NAME.add("念云"); CN_FIRST_NAME.add("高洁"); CN_FIRST_NAME.add("寄灵"); CN_FIRST_NAME.add("立人"); CN_FIRST_NAME.add("雪曼"); CN_FIRST_NAME.add("芳馥"); CN_FIRST_NAME.add("芷天"); CN_FIRST_NAME.add("半青"); CN_FIRST_NAME.add("芳馨"); CN_FIRST_NAME.add("懿轩"); CN_FIRST_NAME.add("明熙"); CN_FIRST_NAME.add("欣合"); CN_FIRST_NAME.add("丽珠"); CN_FIRST_NAME.add("月华"); CN_FIRST_NAME.add("问薇"); CN_FIRST_NAME.add("书仪"); CN_FIRST_NAME.add("昌燎"); CN_FIRST_NAME.add("令羽"); CN_FIRST_NAME.add("萌运"); CN_FIRST_NAME.add("天慧"); CN_FIRST_NAME.add("傲柏"); CN_FIRST_NAME.add("妙双"); CN_FIRST_NAME.add("睿哲"); CN_FIRST_NAME.add("妙珍"); CN_FIRST_NAME.add("晓楠"); CN_FIRST_NAME.add("文成"); CN_FIRST_NAME.add("傲柔"); CN_FIRST_NAME.add("依楠"); CN_FIRST_NAME.add("修美"); CN_FIRST_NAME.add("正豪"); CN_FIRST_NAME.add("绮云"); CN_FIRST_NAME.add("菱华"); CN_FIRST_NAME.add("晨曦"); CN_FIRST_NAME.add("景明"); CN_FIRST_NAME.add("丽君"); CN_FIRST_NAME.add("小枫"); CN_FIRST_NAME.add("叶芳"); CN_FIRST_NAME.add("迎荷"); CN_FIRST_NAME.add("向彤"); CN_FIRST_NAME.add("星辰"); CN_FIRST_NAME.add("凝莲"); CN_FIRST_NAME.add("紫蕙"); CN_FIRST_NAME.add("巧云"); CN_FIRST_NAME.add("明凝"); CN_FIRST_NAME.add("子默"); CN_FIRST_NAME.add("修德"); CN_FIRST_NAME.add("杨柳"); CN_FIRST_NAME.add("布欣"); CN_FIRST_NAME.add("彬彬"); CN_FIRST_NAME.add("梓莹"); CN_FIRST_NAME.add("嘉良"); CN_FIRST_NAME.add("笑晴"); CN_FIRST_NAME.add("波鸿"); CN_FIRST_NAME.add("元白"); CN_FIRST_NAME.add("夏蓉"); CN_FIRST_NAME.add("静秀"); CN_FIRST_NAME.add("轶丽"); CN_FIRST_NAME.add("水卉"); CN_FIRST_NAME.add("翊君"); CN_FIRST_NAME.add("逸雅"); CN_FIRST_NAME.add("雅诗"); CN_FIRST_NAME.add("涵蓄"); CN_FIRST_NAME.add("晨朗"); CN_FIRST_NAME.add("如雪"); CN_FIRST_NAME.add("坚秉"); CN_FIRST_NAME.add("冷梅"); CN_FIRST_NAME.add("悠婉"); CN_FIRST_NAME.add("彭彭"); CN_FIRST_NAME.add("奇希"); CN_FIRST_NAME.add("良才"); CN_FIRST_NAME.add("梓菱"); CN_FIRST_NAME.add("紫文"); CN_FIRST_NAME.add("紫薇"); CN_FIRST_NAME.add("骊雪"); CN_FIRST_NAME.add("令怡"); CN_FIRST_NAME.add("静姝"); CN_FIRST_NAME.add("恬悦"); CN_FIRST_NAME.add("兴邦"); CN_FIRST_NAME.add("暄莹"); CN_FIRST_NAME.add("奥婷"); CN_FIRST_NAME.add("淑慧"); CN_FIRST_NAME.add("忻乐"); CN_FIRST_NAME.add("浩淼"); CN_FIRST_NAME.add("高超"); CN_FIRST_NAME.add("岚霏"); CN_FIRST_NAME.add("承恩"); CN_FIRST_NAME.add("雪松"); CN_FIRST_NAME.add("骊霞"); CN_FIRST_NAME.add("友桃"); CN_FIRST_NAME.add("凌春"); CN_FIRST_NAME.add("箫吟"); CN_FIRST_NAME.add("志勇"); CN_FIRST_NAME.add("远航"); CN_FIRST_NAME.add("慧艳"); CN_FIRST_NAME.add("芸馨"); CN_FIRST_NAME.add("千风"); CN_FIRST_NAME.add("问春"); CN_FIRST_NAME.add("宜嘉"); CN_FIRST_NAME.add("静娴"); CN_FIRST_NAME.add("尔蝶"); CN_FIRST_NAME.add("贞静"); CN_FIRST_NAME.add("英勋"); CN_FIRST_NAME.add("锐意"); CN_FIRST_NAME.add("颐和"); CN_FIRST_NAME.add("运莱"); CN_FIRST_NAME.add("立轩"); CN_FIRST_NAME.add("长卿"); CN_FIRST_NAME.add("梓萱"); CN_FIRST_NAME.add("雨柏"); CN_FIRST_NAME.add("隽洁"); CN_FIRST_NAME.add("饮香"); CN_FIRST_NAME.add("浩丽"); CN_FIRST_NAME.add("浩渺"); CN_FIRST_NAME.add("静婉"); CN_FIRST_NAME.add("成业"); CN_FIRST_NAME.add("承悦"); CN_FIRST_NAME.add("玛丽"); CN_FIRST_NAME.add("天成"); CN_FIRST_NAME.add("凌晓"); CN_FIRST_NAME.add("昆卉"); CN_FIRST_NAME.add("友梅"); CN_FIRST_NAME.add("清宁"); CN_FIRST_NAME.add("立辉"); CN_FIRST_NAME.add("雪枫"); CN_FIRST_NAME.add("嘉茂"); CN_FIRST_NAME.add("驰婷"); CN_FIRST_NAME.add("智敏"); CN_FIRST_NAME.add("阳州"); CN_FIRST_NAME.add("安顺"); CN_FIRST_NAME.add("星火"); CN_FIRST_NAME.add("惜玉"); CN_FIRST_NAME.add("婷秀"); CN_FIRST_NAME.add("凌晴"); CN_FIRST_NAME.add("谷玉"); CN_FIRST_NAME.add("泽宇"); CN_FIRST_NAME.add("运菱"); CN_FIRST_NAME.add("珠星"); CN_FIRST_NAME.add("伟祺"); CN_FIRST_NAME.add("聪慧"); CN_FIRST_NAME.add("昌勋"); CN_FIRST_NAME.add("子美"); CN_FIRST_NAME.add("芸姝"); CN_FIRST_NAME.add("语山"); CN_FIRST_NAME.add("和光"); CN_FIRST_NAME.add("驰媛"); CN_FIRST_NAME.add("景曜"); CN_FIRST_NAME.add("盼旋"); CN_FIRST_NAME.add("婵娟"); CN_FIRST_NAME.add("淑懿"); CN_FIRST_NAME.add("开济"); CN_FIRST_NAME.add("紫易"); CN_FIRST_NAME.add("宛白"); CN_FIRST_NAME.add("偲偲"); CN_FIRST_NAME.add("和煦"); CN_FIRST_NAME.add("尔柳"); CN_FIRST_NAME.add("绿海"); CN_FIRST_NAME.add("之卉"); CN_FIRST_NAME.add("痴旋"); CN_FIRST_NAME.add("雪柳"); CN_FIRST_NAME.add("高义"); CN_FIRST_NAME.add("惜珊"); CN_FIRST_NAME.add("涵蕾"); CN_FIRST_NAME.add("元青"); CN_FIRST_NAME.add("慧英"); CN_FIRST_NAME.add("正浩"); CN_FIRST_NAME.add("建业"); CN_FIRST_NAME.add("英华"); CN_FIRST_NAME.add("嘉荣"); CN_FIRST_NAME.add("中震"); CN_FIRST_NAME.add("玟丽"); CN_FIRST_NAME.add("高丽"); CN_FIRST_NAME.add("秀逸"); CN_FIRST_NAME.add("建中"); CN_FIRST_NAME.add("文茵"); CN_FIRST_NAME.add("建义"); CN_FIRST_NAME.add("贞韵"); CN_FIRST_NAME.add("晴虹"); CN_FIRST_NAME.add("英卫"); CN_FIRST_NAME.add("芮安"); CN_FIRST_NAME.add("雨梅"); CN_FIRST_NAME.add("欣畅"); CN_FIRST_NAME.add("琦巧"); CN_FIRST_NAME.add("英卓"); CN_FIRST_NAME.add("沛柔"); CN_FIRST_NAME.add("亦梅"); CN_FIRST_NAME.add("夏旋"); CN_FIRST_NAME.add("之玉"); CN_FIRST_NAME.add("盼易"); CN_FIRST_NAME.add("慕蕊"); CN_FIRST_NAME.add("英博"); CN_FIRST_NAME.add("丰雅"); CN_FIRST_NAME.add("博雅"); CN_FIRST_NAME.add("茂典"); CN_FIRST_NAME.add("斯年"); CN_FIRST_NAME.add("曲静"); CN_FIRST_NAME.add("觅翠"); CN_FIRST_NAME.add("迎蓉"); CN_FIRST_NAME.add("梓蓓"); CN_FIRST_NAME.add("宏硕"); CN_FIRST_NAME.add("南霜"); CN_FIRST_NAME.add("舒云"); CN_FIRST_NAME.add("艳芳"); CN_FIRST_NAME.add("南露"); CN_FIRST_NAME.add("阳平"); CN_FIRST_NAME.add("悦媛"); CN_FIRST_NAME.add("子怀"); CN_FIRST_NAME.add("歆然"); CN_FIRST_NAME.add("成仁"); CN_FIRST_NAME.add("倩秀"); CN_FIRST_NAME.add("痴春"); CN_FIRST_NAME.add("蕴藉"); CN_FIRST_NAME.add("修能"); CN_FIRST_NAME.add("瑶瑾"); CN_FIRST_NAME.add("幻巧"); CN_FIRST_NAME.add("彦慧"); CN_FIRST_NAME.add("晶晶"); CN_FIRST_NAME.add("雅洁"); CN_FIRST_NAME.add("水瑶"); CN_FIRST_NAME.add("温韦"); CN_FIRST_NAME.add("光霁"); CN_FIRST_NAME.add("青寒"); CN_FIRST_NAME.add("静竹"); CN_FIRST_NAME.add("妍雅"); CN_FIRST_NAME.add("采枫"); CN_FIRST_NAME.add("虹星"); CN_FIRST_NAME.add("智明"); CN_FIRST_NAME.add("从菡"); CN_FIRST_NAME.add("子怡"); CN_FIRST_NAME.add("飞语"); CN_FIRST_NAME.add("甜恬"); CN_FIRST_NAME.add("千秋"); CN_FIRST_NAME.add("海超"); CN_FIRST_NAME.add("平绿"); CN_FIRST_NAME.add("之双"); CN_FIRST_NAME.add("楚洁"); CN_FIRST_NAME.add("婷婷"); CN_FIRST_NAME.add("昆琦"); CN_FIRST_NAME.add("浩漫"); CN_FIRST_NAME.add("涵易"); CN_FIRST_NAME.add("丝祺"); CN_FIRST_NAME.add("敬曦"); CN_FIRST_NAME.add("盼晴"); CN_FIRST_NAME.add("诗翠"); CN_FIRST_NAME.add("星然"); CN_FIRST_NAME.add("慧捷"); CN_FIRST_NAME.add("晴曦"); CN_FIRST_NAME.add("英叡"); CN_FIRST_NAME.add("又槐"); CN_FIRST_NAME.add("长钰"); CN_FIRST_NAME.add("涵映"); CN_FIRST_NAME.add("星光"); CN_FIRST_NAME.add("凝蕊"); CN_FIRST_NAME.add("铭晨"); CN_FIRST_NAME.add("玉兰"); CN_FIRST_NAME.add("令慧"); CN_FIRST_NAME.add("星儿"); CN_FIRST_NAME.add("笑柳"); CN_FIRST_NAME.add("安祯"); CN_FIRST_NAME.add("康盛"); CN_FIRST_NAME.add("正清"); CN_FIRST_NAME.add("智晖"); CN_FIRST_NAME.add("英发"); CN_FIRST_NAME.add("梓敏"); CN_FIRST_NAME.add("含巧"); CN_FIRST_NAME.add("诗怀"); CN_FIRST_NAME.add("正业"); CN_FIRST_NAME.add("元基"); CN_FIRST_NAME.add("采柳"); CN_FIRST_NAME.add("凌蝶"); CN_FIRST_NAME.add("韵梅"); CN_FIRST_NAME.add("祺祥"); CN_FIRST_NAME.add("夜蓉"); CN_FIRST_NAME.add("喜儿"); CN_FIRST_NAME.add("安福"); CN_FIRST_NAME.add("佩兰"); CN_FIRST_NAME.add("自珍"); CN_FIRST_NAME.add("宏壮"); CN_FIRST_NAME.add("惠君"); CN_FIRST_NAME.add("红香"); CN_FIRST_NAME.add("小楠"); CN_FIRST_NAME.add("鸿文"); CN_FIRST_NAME.add("康震"); CN_FIRST_NAME.add("燕晨"); CN_FIRST_NAME.add("静安"); CN_FIRST_NAME.add("泰鸿"); CN_FIRST_NAME.add("耘豪"); CN_FIRST_NAME.add("木兰"); CN_FIRST_NAME.add("寒烟"); CN_FIRST_NAME.add("松月"); CN_FIRST_NAME.add("曼雁"); CN_FIRST_NAME.add("欣嘉"); CN_FIRST_NAME.add("蔚然"); CN_FIRST_NAME.add("安妮"); CN_FIRST_NAME.add("维运"); CN_FIRST_NAME.add("祺福"); CN_FIRST_NAME.add("平彤"); CN_FIRST_NAME.add("子悦"); CN_FIRST_NAME.add("骊颖"); CN_FIRST_NAME.add("迎蕾"); CN_FIRST_NAME.add("凯捷"); CN_FIRST_NAME.add("雁丝"); CN_FIRST_NAME.add("友槐"); CN_FIRST_NAME.add("问枫"); CN_FIRST_NAME.add("紫杉"); CN_FIRST_NAME.add("宏大"); CN_FIRST_NAME.add("乐珍"); CN_FIRST_NAME.add("乐双"); CN_FIRST_NAME.add("绍钧"); CN_FIRST_NAME.add("飞沉"); CN_FIRST_NAME.add("奇志"); CN_FIRST_NAME.add("思语"); CN_FIRST_NAME.add("岚风"); CN_FIRST_NAME.add("映冬"); CN_FIRST_NAME.add("霞英"); CN_FIRST_NAME.add("高轩"); CN_FIRST_NAME.add("善和"); CN_FIRST_NAME.add("琇芳"); CN_FIRST_NAME.add("凝旋"); CN_FIRST_NAME.add("半香"); CN_FIRST_NAME.add("念烟"); CN_FIRST_NAME.add("如风"); CN_FIRST_NAME.add("凌柏"); CN_FIRST_NAME.add("琇芬"); CN_FIRST_NAME.add("泰平"); CN_FIRST_NAME.add("俊明"); CN_FIRST_NAME.add("暄文"); CN_FIRST_NAME.add("瑾瑜"); CN_FIRST_NAME.add("丝娜"); CN_FIRST_NAME.add("铃语"); CN_FIRST_NAME.add("子惠"); CN_FIRST_NAME.add("明珠"); CN_FIRST_NAME.add("抒怀"); CN_FIRST_NAME.add("弘毅"); CN_FIRST_NAME.add("采梦"); CN_FIRST_NAME.add("从蓉"); CN_FIRST_NAME.add("景行"); CN_FIRST_NAME.add("慕晴"); CN_FIRST_NAME.add("瑾瑶"); CN_FIRST_NAME.add("安娜"); CN_FIRST_NAME.add("海之"); CN_FIRST_NAME.add("悦宜"); CN_FIRST_NAME.add("平心"); CN_FIRST_NAME.add("奇思"); CN_FIRST_NAME.add("绮烟"); CN_FIRST_NAME.add("秀兰"); CN_FIRST_NAME.add("安娴"); CN_FIRST_NAME.add("书兰"); CN_FIRST_NAME.add("洛妃"); CN_FIRST_NAME.add("俊晖"); CN_FIRST_NAME.add("昆锐"); CN_FIRST_NAME.add("翰采"); CN_FIRST_NAME.add("云水"); CN_FIRST_NAME.add("吟怀"); CN_FIRST_NAME.add("碧玉"); CN_FIRST_NAME.add("琼岚"); CN_FIRST_NAME.add("俊晤"); CN_FIRST_NAME.add("新美"); CN_FIRST_NAME.add("夏月"); CN_FIRST_NAME.add("问柳"); CN_FIRST_NAME.add("曼青"); CN_FIRST_NAME.add("丹雪"); CN_FIRST_NAME.add("情韵"); CN_FIRST_NAME.add("浩瀚"); CN_FIRST_NAME.add("华奥"); CN_FIRST_NAME.add("蝶梦"); CN_FIRST_NAME.add("天菱"); CN_FIRST_NAME.add("鸿晖"); CN_FIRST_NAME.add("璇玑"); CN_FIRST_NAME.add("皓君"); CN_FIRST_NAME.add("春兰"); CN_FIRST_NAME.add("忆雪"); CN_FIRST_NAME.add("齐敏"); CN_FIRST_NAME.add("灿灿"); CN_FIRST_NAME.add("娅楠"); CN_FIRST_NAME.add("芷容"); CN_FIRST_NAME.add("高澹"); CN_FIRST_NAME.add("真茹"); CN_FIRST_NAME.add("高达"); CN_FIRST_NAME.add("阳德"); CN_FIRST_NAME.add("梦菡"); CN_FIRST_NAME.add("淳美"); CN_FIRST_NAME.add("阳羽"); CN_FIRST_NAME.add("俊智"); CN_FIRST_NAME.add("星爵"); CN_FIRST_NAME.add("彦芝"); CN_FIRST_NAME.add("金枝"); CN_FIRST_NAME.add("梦菲"); CN_FIRST_NAME.add("灵凡"); CN_FIRST_NAME.add("海亦"); CN_FIRST_NAME.add("白雪"); CN_FIRST_NAME.add("恨荷"); CN_FIRST_NAME.add("秋灵"); CN_FIRST_NAME.add("雅丹"); CN_FIRST_NAME.add("雅丽"); CN_FIRST_NAME.add("姝丽"); CN_FIRST_NAME.add("可昕"); CN_FIRST_NAME.add("高远"); CN_FIRST_NAME.add("寄南"); CN_FIRST_NAME.add("茂勋"); CN_FIRST_NAME.add("忆霜"); CN_FIRST_NAME.add("代芙"); CN_FIRST_NAME.add("星剑"); CN_FIRST_NAME.add("丽雅"); CN_FIRST_NAME.add("振海"); CN_FIRST_NAME.add("春冬"); CN_FIRST_NAME.add("英锐"); CN_FIRST_NAME.add("英哲"); CN_FIRST_NAME.add("浩邈"); CN_FIRST_NAME.add("乐和"); CN_FIRST_NAME.add("婉慧"); CN_FIRST_NAME.add("乐咏"); CN_FIRST_NAME.add("璇珠"); CN_FIRST_NAME.add("尔槐"); CN_FIRST_NAME.add("逸"); CN_FIRST_NAME.add("智杰"); CN_FIRST_NAME.add("代芹"); CN_FIRST_NAME.add("志用"); CN_FIRST_NAME.add("书凝"); CN_FIRST_NAME.add("建修"); CN_FIRST_NAME.add("寒凝"); CN_FIRST_NAME.add("问梅"); CN_FIRST_NAME.add("永长"); CN_FIRST_NAME.add("新翰"); CN_FIRST_NAME.add("绮兰"); CN_FIRST_NAME.add("微婉"); CN_FIRST_NAME.add("痴柏"); CN_FIRST_NAME.add("昕珏"); CN_FIRST_NAME.add("翠琴"); CN_FIRST_NAME.add("春燕"); CN_FIRST_NAME.add("梓暄"); CN_FIRST_NAME.add("南风"); CN_FIRST_NAME.add("香雪"); CN_FIRST_NAME.add("逸馨"); CN_FIRST_NAME.add("巧兰"); CN_FIRST_NAME.add("碧琴"); CN_FIRST_NAME.add("碧琳"); CN_FIRST_NAME.add("筠心"); CN_FIRST_NAME.add("若雁"); CN_FIRST_NAME.add("如馨"); CN_FIRST_NAME.add("明钰"); CN_FIRST_NAME.add("芃芃"); CN_FIRST_NAME.add("项禹"); CN_FIRST_NAME.add("高逸"); CN_FIRST_NAME.add("和玉"); CN_FIRST_NAME.add("澎湃"); CN_FIRST_NAME.add("盼柳"); CN_FIRST_NAME.add("经略"); CN_FIRST_NAME.add("从蕾"); CN_FIRST_NAME.add("曼音"); CN_FIRST_NAME.add("楚云"); CN_FIRST_NAME.add("雅云"); CN_FIRST_NAME.add("奇胜"); CN_FIRST_NAME.add("夜春"); CN_FIRST_NAME.add("海伦"); CN_FIRST_NAME.add("云泽"); CN_FIRST_NAME.add("思洁"); CN_FIRST_NAME.add("紫桐"); CN_FIRST_NAME.add("骏奇"); CN_FIRST_NAME.add("悠素"); CN_FIRST_NAME.add("耘涛"); CN_FIRST_NAME.add("忻然"); CN_FIRST_NAME.add("沛槐"); CN_FIRST_NAME.add("逸秀"); CN_FIRST_NAME.add("琇莹"); CN_FIRST_NAME.add("颐真"); CN_FIRST_NAME.add("运晟"); CN_FIRST_NAME.add("意远"); CN_FIRST_NAME.add("越泽"); CN_FIRST_NAME.add("高邈"); CN_FIRST_NAME.add("文敏"); CN_FIRST_NAME.add("骏祥"); CN_FIRST_NAME.add("英喆"); CN_FIRST_NAME.add("朵儿"); CN_FIRST_NAME.add("明哲"); CN_FIRST_NAME.add("香露"); CN_FIRST_NAME.add("鸿朗"); CN_FIRST_NAME.add("梅梅"); CN_FIRST_NAME.add("康顺"); CN_FIRST_NAME.add("姣丽"); CN_FIRST_NAME.add("华婉"); CN_FIRST_NAME.add("飞跃"); CN_FIRST_NAME.add("运虹"); CN_FIRST_NAME.add("骊娜"); CN_FIRST_NAME.add("骊娟"); CN_FIRST_NAME.add("乐生"); CN_FIRST_NAME.add("平惠"); CN_FIRST_NAME.add("子舒"); CN_FIRST_NAME.add("天蓉"); CN_FIRST_NAME.add("俊材"); CN_FIRST_NAME.add("璎玑"); CN_FIRST_NAME.add("幻翠"); CN_FIRST_NAME.add("湘君"); CN_FIRST_NAME.add("夏柳"); CN_FIRST_NAME.add("笑槐"); CN_FIRST_NAME.add("巧凡"); CN_FIRST_NAME.add("涵柳"); CN_FIRST_NAME.add("正信"); CN_FIRST_NAME.add("兴发"); CN_FIRST_NAME.add("永嘉"); CN_FIRST_NAME.add("德馨"); CN_FIRST_NAME.add("天蓝"); CN_FIRST_NAME.add("浩然"); CN_FIRST_NAME.add("叶春"); CN_FIRST_NAME.add("文斌"); CN_FIRST_NAME.add("嫔然"); CN_FIRST_NAME.add("玉华"); CN_FIRST_NAME.add("俊杰"); CN_FIRST_NAME.add("初彤"); CN_FIRST_NAME.add("依波"); CN_FIRST_NAME.add("贞婉"); CN_FIRST_NAME.add("寄琴"); CN_FIRST_NAME.add("安筠"); CN_FIRST_NAME.add("迎曼"); CN_FIRST_NAME.add("斌蔚"); CN_FIRST_NAME.add("星华"); CN_FIRST_NAME.add("仪芳"); CN_FIRST_NAME.add("语彤"); CN_FIRST_NAME.add("飞丹"); CN_FIRST_NAME.add("和同"); CN_FIRST_NAME.add("昂雄"); CN_FIRST_NAME.add("骊婧"); CN_FIRST_NAME.add("安宁"); CN_FIRST_NAME.add("山彤"); CN_FIRST_NAME.add("痴梅"); CN_FIRST_NAME.add("端丽"); CN_FIRST_NAME.add("涵桃"); CN_FIRST_NAME.add("艳蕊"); CN_FIRST_NAME.add("起运"); CN_FIRST_NAME.add("冉冉"); CN_FIRST_NAME.add("安安"); CN_FIRST_NAME.add("幼怡"); CN_FIRST_NAME.add("莉莉"); CN_FIRST_NAME.add("凝蝶"); CN_FIRST_NAME.add("昊嘉"); CN_FIRST_NAME.add("明喆"); CN_FIRST_NAME.add("思涵"); CN_FIRST_NAME.add("涵衍"); CN_FIRST_NAME.add("安宜"); CN_FIRST_NAME.add("寄瑶"); CN_FIRST_NAME.add("赫然"); CN_FIRST_NAME.add("康复"); CN_FIRST_NAME.add("弘济"); CN_FIRST_NAME.add("骊婷"); CN_FIRST_NAME.add("燕桦"); CN_FIRST_NAME.add("昆皓"); CN_FIRST_NAME.add("宇寰"); CN_FIRST_NAME.add("骊媛"); CN_FIRST_NAME.add("靖巧"); CN_FIRST_NAME.add("玉环"); CN_FIRST_NAME.add("佩玉"); CN_FIRST_NAME.add("芊芊"); CN_FIRST_NAME.add("醉冬"); CN_FIRST_NAME.add("颀秀"); CN_FIRST_NAME.add("宛妙"); CN_FIRST_NAME.add("艳蕙"); CN_FIRST_NAME.add("文昂"); CN_FIRST_NAME.add("玉珂"); CN_FIRST_NAME.add("冰洁"); CN_FIRST_NAME.add("安容"); CN_FIRST_NAME.add("安寒"); CN_FIRST_NAME.add("子芸"); CN_FIRST_NAME.add("语心"); CN_FIRST_NAME.add("以莲"); CN_FIRST_NAME.add("文昌"); CN_FIRST_NAME.add("梦蕊"); CN_FIRST_NAME.add("初翠"); CN_FIRST_NAME.add("仲舒"); CN_FIRST_NAME.add("长霞"); CN_FIRST_NAME.add("妙音"); CN_FIRST_NAME.add("昆雄"); CN_FIRST_NAME.add("思淼"); CN_FIRST_NAME.add("文星"); CN_FIRST_NAME.add("天薇"); CN_FIRST_NAME.add("半安"); CN_FIRST_NAME.add("向荣"); CN_FIRST_NAME.add("灵卉"); CN_FIRST_NAME.add("云淡"); CN_FIRST_NAME.add("司晨"); CN_FIRST_NAME.add("涵梅"); CN_FIRST_NAME.add("秀华"); CN_FIRST_NAME.add("惜雪"); CN_FIRST_NAME.add("谷雪"); CN_FIRST_NAME.add("建元"); CN_FIRST_NAME.add("千山"); CN_FIRST_NAME.add("清绮"); CN_FIRST_NAME.add("奇致"); CN_FIRST_NAME.add("澄邈"); CN_FIRST_NAME.add("雅达"); CN_FIRST_NAME.add("柔绚"); CN_FIRST_NAME.add("斌斌"); CN_FIRST_NAME.add("舒兰"); CN_FIRST_NAME.add("佩珍"); CN_FIRST_NAME.add("高兴"); CN_FIRST_NAME.add("和璧"); CN_FIRST_NAME.add("雅辰"); CN_FIRST_NAME.add("宛秋"); CN_FIRST_NAME.add("元驹"); CN_FIRST_NAME.add("莎莉"); CN_FIRST_NAME.add("妍妍"); CN_FIRST_NAME.add("梓柔"); CN_FIRST_NAME.add("海逸"); CN_FIRST_NAME.add("嫚儿"); CN_FIRST_NAME.add("银柳"); CN_FIRST_NAME.add("运杰"); CN_FIRST_NAME.add("娅欣"); CN_FIRST_NAME.add("凯旋"); CN_FIRST_NAME.add("晨欣"); CN_FIRST_NAME.add("书南"); CN_FIRST_NAME.add("访文"); CN_FIRST_NAME.add("文景"); CN_FIRST_NAME.add("春华"); CN_FIRST_NAME.add("暮芸"); CN_FIRST_NAME.add("思义"); CN_FIRST_NAME.add("玉琲"); CN_FIRST_NAME.add("冰海"); CN_FIRST_NAME.add("莎莎"); CN_FIRST_NAME.add("睿好"); CN_FIRST_NAME.add("弘深"); CN_FIRST_NAME.add("勇毅"); CN_FIRST_NAME.add("宵雨"); CN_FIRST_NAME.add("浩初"); CN_FIRST_NAME.add("慕梅"); CN_FIRST_NAME.add("驰鸿"); CN_FIRST_NAME.add("文虹"); CN_FIRST_NAME.add("彩萱"); CN_FIRST_NAME.add("梦旋"); CN_FIRST_NAME.add("慧晨"); CN_FIRST_NAME.add("恨蕊"); CN_FIRST_NAME.add("灵珊"); CN_FIRST_NAME.add("寻云"); CN_FIRST_NAME.add("怜云"); CN_FIRST_NAME.add("白风"); CN_FIRST_NAME.add("慧智"); CN_FIRST_NAME.add("经国"); CN_FIRST_NAME.add("琴心"); CN_FIRST_NAME.add("雅逸"); CN_FIRST_NAME.add("布侬"); CN_FIRST_NAME.add("小谷"); CN_FIRST_NAME.add("弘业"); CN_FIRST_NAME.add("素欣"); CN_FIRST_NAME.add("斐斐"); CN_FIRST_NAME.add("源源"); CN_FIRST_NAME.add("志国"); CN_FIRST_NAME.add("嘉月"); CN_FIRST_NAME.add("宏富"); CN_FIRST_NAME.add("玉瑾"); CN_FIRST_NAME.add("思源"); CN_FIRST_NAME.add("思云"); CN_FIRST_NAME.add("梦易"); CN_FIRST_NAME.add("兴生"); CN_FIRST_NAME.add("思溪"); CN_FIRST_NAME.add("华容"); CN_FIRST_NAME.add("奥维"); CN_FIRST_NAME.add("燕楠"); CN_FIRST_NAME.add("晓丝"); CN_FIRST_NAME.add("绮南"); CN_FIRST_NAME.add("妙颜"); CN_FIRST_NAME.add("依丝"); CN_FIRST_NAME.add("阳舒"); CN_FIRST_NAME.add("弘丽"); CN_FIRST_NAME.add("阳成"); CN_FIRST_NAME.add("书双"); CN_FIRST_NAME.add("云溪"); CN_FIRST_NAME.add("媛女"); CN_FIRST_NAME.add("和畅"); CN_FIRST_NAME.add("云亭"); CN_FIRST_NAME.add("嘉木"); CN_FIRST_NAME.add("文曜"); CN_FIRST_NAME.add("弘义"); CN_FIRST_NAME.add("心香"); CN_FIRST_NAME.add("星瑶"); CN_FIRST_NAME.add("霞文"); CN_FIRST_NAME.add("白夏"); CN_FIRST_NAME.add("曼妮"); CN_FIRST_NAME.add("琳怡"); CN_FIRST_NAME.add("翠阳"); CN_FIRST_NAME.add("昌盛"); CN_FIRST_NAME.add("觅荷"); CN_FIRST_NAME.add("怡乐"); CN_FIRST_NAME.add("代蓝"); CN_FIRST_NAME.add("雅健"); CN_FIRST_NAME.add("清心"); CN_FIRST_NAME.add("绮玉"); CN_FIRST_NAME.add("元魁"); CN_FIRST_NAME.add("平良"); CN_FIRST_NAME.add("夜柳"); CN_FIRST_NAME.add("绿兰"); CN_FIRST_NAME.add("善静"); CN_FIRST_NAME.add("歌吹"); CN_FIRST_NAME.add("天晴"); CN_FIRST_NAME.add("凝梦"); CN_FIRST_NAME.add("迎梅"); CN_FIRST_NAME.add("茹云"); CN_FIRST_NAME.add("彤蕊"); CN_FIRST_NAME.add("吉敏"); CN_FIRST_NAME.add("良朋"); CN_FIRST_NAME.add("靓影"); CN_FIRST_NAME.add("津童"); CN_FIRST_NAME.add("睿姿"); CN_FIRST_NAME.add("冬亦"); CN_FIRST_NAME.add("胤雅"); CN_FIRST_NAME.add("念珍"); CN_FIRST_NAME.add("宾白"); CN_FIRST_NAME.add("高爽"); CN_FIRST_NAME.add("书君"); CN_FIRST_NAME.add("念双"); CN_FIRST_NAME.add("如容"); CN_FIRST_NAME.add("书琴"); CN_FIRST_NAME.add("凡桃"); CN_FIRST_NAME.add("慧月"); CN_FIRST_NAME.add("梦晨"); CN_FIRST_NAME.add("韵诗"); CN_FIRST_NAME.add("冰之"); CN_FIRST_NAME.add("子菡"); CN_FIRST_NAME.add("依云"); CN_FIRST_NAME.add("弘亮"); CN_FIRST_NAME.add("瀚彭"); CN_FIRST_NAME.add("柔怀"); CN_FIRST_NAME.add("香天"); CN_FIRST_NAME.add("春琳"); CN_FIRST_NAME.add("璞玉"); CN_FIRST_NAME.add("海儿"); CN_FIRST_NAME.add("芮美"); CN_FIRST_NAME.add("清怡"); CN_FIRST_NAME.add("绿凝"); CN_FIRST_NAME.add("承教"); CN_FIRST_NAME.add("嫣然"); CN_FIRST_NAME.add("碧白"); CN_FIRST_NAME.add("丹秋"); CN_FIRST_NAME.add("德宇"); CN_FIRST_NAME.add("英睿"); CN_FIRST_NAME.add("曼婉"); CN_FIRST_NAME.add("敏丽"); CN_FIRST_NAME.add("忆秋"); CN_FIRST_NAME.add("暖暖"); CN_FIRST_NAME.add("良材"); CN_FIRST_NAME.add("颖颖"); CN_FIRST_NAME.add("乐圣"); CN_FIRST_NAME.add("俊楚"); CN_FIRST_NAME.add("俊楠"); CN_FIRST_NAME.add("元容"); CN_FIRST_NAME.add("雁兰"); CN_FIRST_NAME.add("白秋"); CN_FIRST_NAME.add("夜梅"); CN_FIRST_NAME.add("德容"); CN_FIRST_NAME.add("子萱"); CN_FIRST_NAME.add("秋华"); CN_FIRST_NAME.add("蓝尹"); CN_FIRST_NAME.add("醉卉"); CN_FIRST_NAME.add("攸然"); CN_FIRST_NAME.add("天曼"); CN_FIRST_NAME.add("锐藻"); CN_FIRST_NAME.add("辰沛"); CN_FIRST_NAME.add("文林"); CN_FIRST_NAME.add("思佳"); CN_FIRST_NAME.add("夜梦"); CN_FIRST_NAME.add("泽恩"); CN_FIRST_NAME.add("雨泽"); CN_FIRST_NAME.add("望雅"); CN_FIRST_NAME.add("绮琴"); CN_FIRST_NAME.add("成化"); CN_FIRST_NAME.add("访曼"); CN_FIRST_NAME.add("弘伟"); CN_FIRST_NAME.add("以蕊"); CN_FIRST_NAME.add("莘莘"); CN_FIRST_NAME.add("秋玉"); CN_FIRST_NAME.add("水风"); CN_FIRST_NAME.add("正初"); CN_FIRST_NAME.add("海冬"); CN_FIRST_NAME.add("浩博"); CN_FIRST_NAME.add("梓楠"); CN_FIRST_NAME.add("嘉树"); CN_FIRST_NAME.add("德寿"); CN_FIRST_NAME.add("文柏"); CN_FIRST_NAME.add("同方"); CN_FIRST_NAME.add("新苗"); CN_FIRST_NAME.add("修敏"); CN_FIRST_NAME.add("翠霜"); CN_FIRST_NAME.add("月天"); CN_FIRST_NAME.add("念瑶"); CN_FIRST_NAME.add("熙熙"); CN_FIRST_NAME.add("宛筠"); CN_FIRST_NAME.add("梦月"); CN_FIRST_NAME.add("英韶"); CN_FIRST_NAME.add("香馨"); CN_FIRST_NAME.add("吉星"); CN_FIRST_NAME.add("桂华"); CN_FIRST_NAME.add("琇晶"); CN_FIRST_NAME.add("博学"); CN_FIRST_NAME.add("海凡"); CN_FIRST_NAME.add("静美"); CN_FIRST_NAME.add("宏峻"); CN_FIRST_NAME.add("丽姝"); CN_FIRST_NAME.add("岚岚"); CN_FIRST_NAME.add("清悦"); CN_FIRST_NAME.add("天材"); CN_FIRST_NAME.add("昆颉"); CN_FIRST_NAME.add("秋珊"); CN_FIRST_NAME.add("爰美"); CN_FIRST_NAME.add("雁凡"); CN_FIRST_NAME.add("思远"); CN_FIRST_NAME.add("修文"); CN_FIRST_NAME.add("梓榆"); CN_FIRST_NAME.add("易真"); CN_FIRST_NAME.add("思迪"); CN_FIRST_NAME.add("朝雨"); CN_FIRST_NAME.add("高卓"); CN_FIRST_NAME.add("文栋"); CN_FIRST_NAME.add("琼怡"); CN_FIRST_NAME.add("丽姿"); CN_FIRST_NAME.add("博简"); CN_FIRST_NAME.add("彦昌"); CN_FIRST_NAME.add("秋双"); CN_FIRST_NAME.add("琼思"); CN_FIRST_NAME.add("璞瑜"); CN_FIRST_NAME.add("锐智"); CN_FIRST_NAME.add("冷之"); CN_FIRST_NAME.add("昕雨"); CN_FIRST_NAME.add("柔惠"); CN_FIRST_NAME.add("昭君"); CN_FIRST_NAME.add("阳荣"); CN_FIRST_NAME.add("怀玉"); CN_FIRST_NAME.add("昊硕"); CN_FIRST_NAME.add("泽惠"); CN_FIRST_NAME.add("博实"); CN_FIRST_NAME.add("以旋"); CN_FIRST_NAME.add("煜祺"); CN_FIRST_NAME.add("驰翰"); CN_FIRST_NAME.add("博容"); CN_FIRST_NAME.add("翔飞"); CN_FIRST_NAME.add("明知"); CN_FIRST_NAME.add("向薇"); CN_FIRST_NAME.add("向文"); CN_FIRST_NAME.add("建华"); CN_FIRST_NAME.add("傲丝"); CN_FIRST_NAME.add("康宁"); CN_FIRST_NAME.add("力勤"); CN_FIRST_NAME.add("芮悦"); CN_FIRST_NAME.add("乐音"); CN_FIRST_NAME.add("平莹"); CN_FIRST_NAME.add("雅凡"); CN_FIRST_NAME.add("成双"); CN_FIRST_NAME.add("璠瑜"); CN_FIRST_NAME.add("和雅"); CN_FIRST_NAME.add("萌阳"); CN_FIRST_NAME.add("霞月"); CN_FIRST_NAME.add("依辰"); CN_FIRST_NAME.add("康安"); CN_FIRST_NAME.add("彭薄"); CN_FIRST_NAME.add("新荣"); CN_FIRST_NAME.add("惜天"); CN_FIRST_NAME.add("颖馨"); CN_FIRST_NAME.add("玟玉"); CN_FIRST_NAME.add("含芙"); CN_FIRST_NAME.add("冷亦"); CN_FIRST_NAME.add("玲然"); CN_FIRST_NAME.add("妞妞"); CN_FIRST_NAME.add("云逸"); CN_FIRST_NAME.add("玄雅"); CN_FIRST_NAME.add("寄真"); CN_FIRST_NAME.add("娇洁"); CN_FIRST_NAME.add("悦心"); CN_FIRST_NAME.add("昕靓"); CN_FIRST_NAME.add("骞骞"); CN_FIRST_NAME.add("飞烟"); CN_FIRST_NAME.add("傲之"); CN_FIRST_NAME.add("仪文"); CN_FIRST_NAME.add("又亦"); CN_FIRST_NAME.add("高原"); CN_FIRST_NAME.add("旭尧"); CN_FIRST_NAME.add("陶宁"); CN_FIRST_NAME.add("杏儿"); CN_FIRST_NAME.add("星阑"); CN_FIRST_NAME.add("湛雨"); CN_FIRST_NAME.add("芝英"); CN_FIRST_NAME.add("妙婧"); CN_FIRST_NAME.add("采波"); CN_FIRST_NAME.add("修明"); CN_FIRST_NAME.add("浦和"); CN_FIRST_NAME.add("素洁"); CN_FIRST_NAME.add("陶宜"); CN_FIRST_NAME.add("俊誉"); CN_FIRST_NAME.add("峻熙"); CN_FIRST_NAME.add("颖秀"); CN_FIRST_NAME.add("婷美"); CN_FIRST_NAME.add("韵流"); CN_FIRST_NAME.add("安平"); CN_FIRST_NAME.add("曼安"); CN_FIRST_NAME.add("恨蝶"); CN_FIRST_NAME.add("子蕙"); CN_FIRST_NAME.add("兴国"); CN_FIRST_NAME.add("听芹"); CN_FIRST_NAME.add("昊磊"); CN_FIRST_NAME.add("旻骞"); CN_FIRST_NAME.add("白竹"); CN_FIRST_NAME.add("吉月"); CN_FIRST_NAME.add("傲云"); CN_FIRST_NAME.add("平萱"); CN_FIRST_NAME.add("小之"); CN_FIRST_NAME.add("向明"); CN_FIRST_NAME.add("英飙"); CN_FIRST_NAME.add("珍丽"); CN_FIRST_NAME.add("雅爱"); CN_FIRST_NAME.add("映阳"); CN_FIRST_NAME.add("静恬"); CN_FIRST_NAME.add("令暎"); CN_FIRST_NAME.add("以晴"); CN_FIRST_NAME.add("湛霞"); CN_FIRST_NAME.add("伟彦"); CN_FIRST_NAME.add("曼容"); CN_FIRST_NAME.add("惜香"); CN_FIRST_NAME.add("心宜"); CN_FIRST_NAME.add("布凡"); CN_FIRST_NAME.add("悦怡"); CN_FIRST_NAME.add("其雨"); CN_FIRST_NAME.add("飞光"); CN_FIRST_NAME.add("子薇"); CN_FIRST_NAME.add("亦丝"); CN_FIRST_NAME.add("晨涛"); CN_FIRST_NAME.add("飞兰"); CN_FIRST_NAME.add("诗蕊"); CN_FIRST_NAME.add("绍祺"); CN_FIRST_NAME.add("欣笑"); CN_FIRST_NAME.add("敏达"); CN_FIRST_NAME.add("冬灵"); CN_FIRST_NAME.add("山芙"); CN_FIRST_NAME.add("安康"); CN_FIRST_NAME.add("典雅"); CN_FIRST_NAME.add("和静"); CN_FIRST_NAME.add("歌阑"); CN_FIRST_NAME.add("萍雅"); CN_FIRST_NAME.add("若骞"); CN_FIRST_NAME.add("怜烟"); CN_FIRST_NAME.add("灵阳"); CN_FIRST_NAME.add("梦桃"); CN_FIRST_NAME.add("风华"); CN_FIRST_NAME.add("萧玉"); CN_FIRST_NAME.add("昊天"); CN_FIRST_NAME.add("湛静"); CN_FIRST_NAME.add("成周"); CN_FIRST_NAME.add("建同"); CN_FIRST_NAME.add("曼寒"); CN_FIRST_NAME.add("永福"); CN_FIRST_NAME.add("玄静"); CN_FIRST_NAME.add("谷秋"); CN_FIRST_NAME.add("梦桐"); CN_FIRST_NAME.add("流如"); CN_FIRST_NAME.add("思烟"); CN_FIRST_NAME.add("骞魁"); CN_FIRST_NAME.add("幼荷"); CN_FIRST_NAME.add("承望"); CN_FIRST_NAME.add("成和"); CN_FIRST_NAME.add("小溪"); CN_FIRST_NAME.add("正卿"); CN_FIRST_NAME.add("语芹"); CN_FIRST_NAME.add("向晨"); CN_FIRST_NAME.add("诗文"); CN_FIRST_NAME.add("优悠"); CN_FIRST_NAME.add("尔丝"); CN_FIRST_NAME.add("梧桐"); CN_FIRST_NAME.add("优悦"); CN_FIRST_NAME.add("忆安"); CN_FIRST_NAME.add("白筠"); CN_FIRST_NAME.add("晓灵"); CN_FIRST_NAME.add("倩美"); CN_FIRST_NAME.add("伟志"); CN_FIRST_NAME.add("长娟"); CN_FIRST_NAME.add("英奕"); CN_FIRST_NAME.add("诗蕾"); CN_FIRST_NAME.add("清懿"); CN_FIRST_NAME.add("刚捷"); CN_FIRST_NAME.add("悦恺"); CN_FIRST_NAME.add("凌波"); CN_FIRST_NAME.add("清舒"); CN_FIRST_NAME.add("亦云"); CN_FIRST_NAME.add("白安"); CN_FIRST_NAME.add("星雨"); CN_FIRST_NAME.add("飞燕"); CN_FIRST_NAME.add("林楠"); CN_FIRST_NAME.add("忻畅"); CN_FIRST_NAME.add("圣杰"); CN_FIRST_NAME.add("彦杉"); CN_FIRST_NAME.add("振凯"); CN_FIRST_NAME.add("映雁"); CN_FIRST_NAME.add("丹寒"); CN_FIRST_NAME.add("钰"); CN_FIRST_NAME.add("子明"); CN_FIRST_NAME.add("子昂"); CN_FIRST_NAME.add("家馨"); CN_FIRST_NAME.add("雁卉"); CN_FIRST_NAME.add("平蓝"); CN_FIRST_NAME.add("听荷"); CN_FIRST_NAME.add("映雪"); CN_FIRST_NAME.add("晏然"); CN_FIRST_NAME.add("乐天"); CN_FIRST_NAME.add("白容"); CN_FIRST_NAME.add("访梦"); CN_FIRST_NAME.add("景浩"); CN_FIRST_NAME.add("恨桃"); CN_FIRST_NAME.add("熙华"); CN_FIRST_NAME.add("暖梦"); CN_FIRST_NAME.add("书白"); CN_FIRST_NAME.add("箫笛"); CN_FIRST_NAME.add("晴波"); CN_FIRST_NAME.add("馨香"); CN_FIRST_NAME.add("和韵"); CN_FIRST_NAME.add("含莲"); CN_FIRST_NAME.add("琳芳"); CN_FIRST_NAME.add("安彤"); CN_FIRST_NAME.add("子晋"); CN_FIRST_NAME.add("秀隽"); CN_FIRST_NAME.add("桐华"); CN_FIRST_NAME.add("映真"); CN_FIRST_NAME.add("尔云"); CN_FIRST_NAME.add("梓欣"); CN_FIRST_NAME.add("幼菱"); CN_FIRST_NAME.add("英秀"); CN_FIRST_NAME.add("季萌"); CN_FIRST_NAME.add("孤菱"); CN_FIRST_NAME.add("秀雅"); CN_FIRST_NAME.add("听莲"); CN_FIRST_NAME.add("书雁"); CN_FIRST_NAME.add("曼岚"); CN_FIRST_NAME.add("韶丽"); CN_FIRST_NAME.add("丽容"); CN_FIRST_NAME.add("寻冬"); CN_FIRST_NAME.add("嘉言"); CN_FIRST_NAME.add("灵雨"); CN_FIRST_NAME.add("孤萍"); CN_FIRST_NAME.add("巍奕"); CN_FIRST_NAME.add("寒雁"); CN_FIRST_NAME.add("流婉"); CN_FIRST_NAME.add("奇文"); CN_FIRST_NAME.add("慕诗"); CN_FIRST_NAME.add("以松"); CN_FIRST_NAME.add("锦文"); CN_FIRST_NAME.add("依然"); CN_FIRST_NAME.add("丝微"); CN_FIRST_NAME.add("怡然"); CN_FIRST_NAME.add("弘光"); CN_FIRST_NAME.add("静慧"); CN_FIRST_NAME.add("雯丽"); CN_FIRST_NAME.add("幼萱"); CN_FIRST_NAME.add("芙蓉"); CN_FIRST_NAME.add("和硕"); CN_FIRST_NAME.add("音仪"); CN_FIRST_NAME.add("君昊"); CN_FIRST_NAME.add("修杰"); CN_FIRST_NAME.add("水竹"); CN_FIRST_NAME.add("寻凝"); CN_FIRST_NAME.add("清芬"); CN_FIRST_NAME.add("骊红"); CN_FIRST_NAME.add("星睿"); CN_FIRST_NAME.add("令枫"); CN_FIRST_NAME.add("丹山"); CN_FIRST_NAME.add("雨伯"); CN_FIRST_NAME.add("代柔"); CN_FIRST_NAME.add("润丽"); CN_FIRST_NAME.add("骞尧"); CN_FIRST_NAME.add("余妍"); CN_FIRST_NAME.add("觅晴"); CN_FIRST_NAME.add("安翔"); CN_FIRST_NAME.add("颜骏"); CN_FIRST_NAME.add("念雁"); CN_FIRST_NAME.add("舒畅"); CN_FIRST_NAME.add("和顺"); CN_FIRST_NAME.add("安志"); CN_FIRST_NAME.add("余馥"); CN_FIRST_NAME.add("盼波"); CN_FIRST_NAME.add("春雪"); CN_FIRST_NAME.add("俊语"); CN_FIRST_NAME.add("思凡"); CN_FIRST_NAME.add("春雨"); CN_FIRST_NAME.add("晓兰"); CN_FIRST_NAME.add("诗晗"); CN_FIRST_NAME.add("和颂"); CN_FIRST_NAME.add("高畅"); CN_FIRST_NAME.add("平文"); CN_FIRST_NAME.add("寄风"); CN_FIRST_NAME.add("玉韵"); CN_FIRST_NAME.add("玉石"); CN_FIRST_NAME.add("向松"); CN_FIRST_NAME.add("俊民"); CN_FIRST_NAME.add("芬芬"); CN_FIRST_NAME.add("家骏"); CN_FIRST_NAME.add("景中"); CN_FIRST_NAME.add("雪漫"); CN_FIRST_NAME.add("湛颖"); CN_FIRST_NAME.add("玉堂"); CN_FIRST_NAME.add("萍韵"); CN_FIRST_NAME.add("白山"); CN_FIRST_NAME.add("山菡"); CN_FIRST_NAME.add("温纶"); CN_FIRST_NAME.add("昊穹"); CN_FIRST_NAME.add("沈然"); CN_FIRST_NAME.add("阳文"); CN_FIRST_NAME.add("韶仪"); CN_FIRST_NAME.add("以柳"); CN_FIRST_NAME.add("嘉誉"); CN_FIRST_NAME.add("戈雅"); CN_FIRST_NAME.add("安怡"); CN_FIRST_NAME.add("斯文"); CN_FIRST_NAME.add("夏波"); CN_FIRST_NAME.add("弘量"); CN_FIRST_NAME.add("芳懿"); CN_FIRST_NAME.add("昊空"); CN_FIRST_NAME.add("新蕾"); CN_FIRST_NAME.add("元纬"); CN_FIRST_NAME.add("念真"); CN_FIRST_NAME.add("浩阔"); CN_FIRST_NAME.add("秋阳"); CN_FIRST_NAME.add("雅珺"); CN_FIRST_NAME.add("和风"); CN_FIRST_NAME.add("代桃"); CN_FIRST_NAME.add("今歌"); CN_FIRST_NAME.add("念霜"); CN_FIRST_NAME.add("念露"); CN_FIRST_NAME.add("华彩"); CN_FIRST_NAME.add("海瑶"); CN_FIRST_NAME.add("言心"); CN_FIRST_NAME.add("骏年"); CN_FIRST_NAME.add("雅可"); CN_FIRST_NAME.add("英媛"); CN_FIRST_NAME.add("凌丝"); CN_FIRST_NAME.add("新文"); CN_FIRST_NAME.add("晓凡"); CN_FIRST_NAME.add("冠玉"); CN_FIRST_NAME.add("梦槐"); CN_FIRST_NAME.add("叶欣"); CN_FIRST_NAME.add("晨潍"); CN_FIRST_NAME.add("依凝"); CN_FIRST_NAME.add("俊豪"); CN_FIRST_NAME.add("德庸"); CN_FIRST_NAME.add("雨信"); CN_FIRST_NAME.add("斯斯"); CN_FIRST_NAME.add("晓燕"); CN_FIRST_NAME.add("振华"); CN_FIRST_NAME.add("琼芳"); CN_FIRST_NAME.add("坚成"); CN_FIRST_NAME.add("问丝"); CN_FIRST_NAME.add("友灵"); CN_FIRST_NAME.add("岚彩"); CN_FIRST_NAME.add("振博"); CN_FIRST_NAME.add("惜筠"); CN_FIRST_NAME.add("阳旭"); CN_FIRST_NAME.add("冰冰"); CN_FIRST_NAME.add("华美"); CN_FIRST_NAME.add("代梅"); CN_FIRST_NAME.add("绮露"); CN_FIRST_NAME.add("痴海"); CN_FIRST_NAME.add("晨轩"); CN_FIRST_NAME.add("旭鹏"); CN_FIRST_NAME.add("翰音"); CN_FIRST_NAME.add("溪澈"); CN_FIRST_NAME.add("元绿"); CN_FIRST_NAME.add("平春"); CN_FIRST_NAME.add("运诚"); CN_FIRST_NAME.add("秋白"); CN_FIRST_NAME.add("雅琴"); CN_FIRST_NAME.add("昕妤"); CN_FIRST_NAME.add("歌韵"); CN_FIRST_NAME.add("妮娜"); CN_FIRST_NAME.add("令梓"); CN_FIRST_NAME.add("令梅"); CN_FIRST_NAME.add("如彤"); CN_FIRST_NAME.add("胤骞"); CN_FIRST_NAME.add("灵韵"); CN_FIRST_NAME.add("玮琪"); CN_FIRST_NAME.add("香岚"); CN_FIRST_NAME.add("北晶"); CN_FIRST_NAME.add("琼英"); CN_FIRST_NAME.add("冰凡"); CN_FIRST_NAME.add("若山"); CN_FIRST_NAME.add("翔宇"); CN_FIRST_NAME.add("晨辰"); CN_FIRST_NAME.add("永宁"); CN_FIRST_NAME.add("晴丽"); CN_FIRST_NAME.add("顺美"); CN_FIRST_NAME.add("逸美"); CN_FIRST_NAME.add("觅松"); CN_FIRST_NAME.add("高阳"); CN_FIRST_NAME.add("平晓"); CN_FIRST_NAME.add("瑞绣"); CN_FIRST_NAME.add("昆宇"); CN_FIRST_NAME.add("玲玲"); CN_FIRST_NAME.add("开畅"); CN_FIRST_NAME.add("玲珑"); CN_FIRST_NAME.add("宜年"); CN_FIRST_NAME.add("嘉歆"); CN_FIRST_NAME.add("骊美"); CN_FIRST_NAME.add("清莹"); CN_FIRST_NAME.add("永安"); CN_FIRST_NAME.add("紫丝"); CN_FIRST_NAME.add("优扬"); CN_FIRST_NAME.add("浩皛"); CN_FIRST_NAME.add("志学"); CN_FIRST_NAME.add("江雪"); CN_FIRST_NAME.add("华翰"); CN_FIRST_NAME.add("初蓝"); CN_FIRST_NAME.add("语蓉"); CN_FIRST_NAME.add("银河"); CN_FIRST_NAME.add("芳芳"); CN_FIRST_NAME.add("静芙"); CN_FIRST_NAME.add("含蕊"); CN_FIRST_NAME.add("晨濡"); CN_FIRST_NAME.add("璇娟"); CN_FIRST_NAME.add("密如"); CN_FIRST_NAME.add("惜寒"); CN_FIRST_NAME.add("映颖"); CN_FIRST_NAME.add("又儿"); CN_FIRST_NAME.add("涵涤"); CN_FIRST_NAME.add("伟懋"); CN_FIRST_NAME.add("柳思"); CN_FIRST_NAME.add("如心"); CN_FIRST_NAME.add("元彤"); CN_FIRST_NAME.add("岚翠"); CN_FIRST_NAME.add("鸿波"); CN_FIRST_NAME.add("芳苓"); CN_FIRST_NAME.add("俊贤"); CN_FIRST_NAME.add("阳晖"); CN_FIRST_NAME.add("野云"); CN_FIRST_NAME.add("锦曦"); CN_FIRST_NAME.add("康平"); CN_FIRST_NAME.add("闲丽"); CN_FIRST_NAME.add("乐章"); CN_FIRST_NAME.add("乐童"); CN_FIRST_NAME.add("涵润"); CN_FIRST_NAME.add("玲琅"); CN_FIRST_NAME.add("雨灵"); CN_FIRST_NAME.add("婉柔"); CN_FIRST_NAME.add("茗雪"); CN_FIRST_NAME.add("兰娜"); CN_FIRST_NAME.add("涵涵"); CN_FIRST_NAME.add("怜南"); CN_FIRST_NAME.add("昊宇"); CN_FIRST_NAME.add("盼丹"); CN_FIRST_NAME.add("薇歌"); CN_FIRST_NAME.add("含文"); CN_FIRST_NAME.add("成益"); CN_FIRST_NAME.add("翰墨"); CN_FIRST_NAME.add("闳丽"); CN_FIRST_NAME.add("黛娥"); CN_FIRST_NAME.add("元龙"); CN_FIRST_NAME.add("飞双"); CN_FIRST_NAME.add("飞珍"); CN_FIRST_NAME.add("觅柔"); CN_FIRST_NAME.add("向梦"); CN_FIRST_NAME.add("宏恺"); CN_FIRST_NAME.add("梓洁"); CN_FIRST_NAME.add("幼旋"); CN_FIRST_NAME.add("嘉许"); CN_FIRST_NAME.add("迎波"); CN_FIRST_NAME.add("瑞彩"); CN_FIRST_NAME.add("傲儿"); CN_FIRST_NAME.add("思卉"); CN_FIRST_NAME.add("新晴"); CN_FIRST_NAME.add("建白"); CN_FIRST_NAME.add("秋露"); CN_FIRST_NAME.add("紫云"); CN_FIRST_NAME.add("永寿"); CN_FIRST_NAME.add("溶溶"); CN_FIRST_NAME.add("怀雁"); CN_FIRST_NAME.add("凝洁"); CN_FIRST_NAME.add("玲琳"); CN_FIRST_NAME.add("蕴涵"); CN_FIRST_NAME.add("鹤梦"); CN_FIRST_NAME.add("贞怡"); CN_FIRST_NAME.add("瑶岑"); CN_FIRST_NAME.add("博延"); CN_FIRST_NAME.add("思博"); CN_FIRST_NAME.add("芬菲"); CN_FIRST_NAME.add("秀颖"); CN_FIRST_NAME.add("智渊"); CN_FIRST_NAME.add("元德"); CN_FIRST_NAME.add("芳荃"); CN_FIRST_NAME.add("学文"); CN_FIRST_NAME.add("语蕊"); CN_FIRST_NAME.add("诗柳"); CN_FIRST_NAME.add("睿广"); CN_FIRST_NAME.add("芳茵"); CN_FIRST_NAME.add("靖荷"); CN_FIRST_NAME.add("逸思"); CN_FIRST_NAME.add("弘化"); CN_FIRST_NAME.add("景辉"); CN_FIRST_NAME.add("元忠"); CN_FIRST_NAME.add("景澄"); CN_FIRST_NAME.add("高雅"); CN_FIRST_NAME.add("翰飞"); CN_FIRST_NAME.add("阳曦"); CN_FIRST_NAME.add("映天"); CN_FIRST_NAME.add("长岳"); CN_FIRST_NAME.add("伟才"); CN_FIRST_NAME.add("桃雨"); CN_FIRST_NAME.add("芸芸"); CN_FIRST_NAME.add("才俊"); CN_FIRST_NAME.add("天欣"); CN_FIRST_NAME.add("旭彬"); CN_FIRST_NAME.add("冬卉"); CN_FIRST_NAME.add("夏之"); CN_FIRST_NAME.add("阳曜"); CN_FIRST_NAME.add("芷若"); CN_FIRST_NAME.add("雅唱"); CN_FIRST_NAME.add("歌飞"); CN_FIRST_NAME.add("晶滢"); CN_FIRST_NAME.add("运洁"); CN_FIRST_NAME.add("怜珊"); CN_FIRST_NAME.add("宏胜"); CN_FIRST_NAME.add("蕙兰"); CN_FIRST_NAME.add("志尚"); CN_FIRST_NAME.add("湛娟"); CN_FIRST_NAME.add("嘉谊"); CN_FIRST_NAME.add("凡波"); CN_FIRST_NAME.add("语薇"); CN_FIRST_NAME.add("方方"); CN_FIRST_NAME.add("乐安"); CN_FIRST_NAME.add("傲冬"); CN_FIRST_NAME.add("凝海"); CN_FIRST_NAME.add("元思"); CN_FIRST_NAME.add("莹莹"); CN_FIRST_NAME.add("雅畅"); CN_FIRST_NAME.add("凯歌"); CN_FIRST_NAME.add("国源"); CN_FIRST_NAME.add("寻双"); CN_FIRST_NAME.add("新曦"); CN_FIRST_NAME.add("怜双"); CN_FIRST_NAME.add("芸若"); CN_FIRST_NAME.add("正阳"); CN_FIRST_NAME.add("尔烟"); CN_FIRST_NAME.add("菁英"); CN_FIRST_NAME.add("朗宁"); CN_FIRST_NAME.add("羽彤"); CN_FIRST_NAME.add("未央"); CN_FIRST_NAME.add("弘博"); CN_FIRST_NAME.add("飞瑶"); CN_FIRST_NAME.add("玄穆"); CN_FIRST_NAME.add("芸茗"); CN_FIRST_NAME.add("莺莺"); CN_FIRST_NAME.add("阳朔"); CN_FIRST_NAME.add("新月"); CN_FIRST_NAME.add("鑫鹏"); CN_FIRST_NAME.add("诗桃"); CN_FIRST_NAME.add("乐容"); CN_FIRST_NAME.add("平松"); CN_FIRST_NAME.add("寅骏"); CN_FIRST_NAME.add("轩秀"); CN_FIRST_NAME.add("妮子"); CN_FIRST_NAME.add("夏云"); CN_FIRST_NAME.add("慧语"); CN_FIRST_NAME.add("晓博"); CN_FIRST_NAME.add("乐家"); CN_FIRST_NAME.add("听春"); CN_FIRST_NAME.add("幼晴"); CN_FIRST_NAME.add("好慕"); CN_FIRST_NAME.add("迎海"); CN_FIRST_NAME.add("香巧"); CN_FIRST_NAME.add("丹红"); CN_FIRST_NAME.add("哲丽"); CN_FIRST_NAME.add("丰羽"); CN_FIRST_NAME.add("依玉"); CN_FIRST_NAME.add("珠轩"); CN_FIRST_NAME.add("雪儿"); CN_FIRST_NAME.add("珠佩"); CN_FIRST_NAME.add("宇航"); CN_FIRST_NAME.add("运浩"); CN_FIRST_NAME.add("弘厚"); CN_FIRST_NAME.add("芳菲"); CN_FIRST_NAME.add("梓涵"); CN_FIRST_NAME.add("海阳"); CN_FIRST_NAME.add("寻琴"); CN_FIRST_NAME.add("世英"); CN_FIRST_NAME.add("涵亮"); CN_FIRST_NAME.add("雨兰"); CN_FIRST_NAME.add("孤晴"); CN_FIRST_NAME.add("寒天"); CN_FIRST_NAME.add("元恺"); CN_FIRST_NAME.add("思琪"); CN_FIRST_NAME.add("景逸"); CN_FIRST_NAME.add("小凝"); CN_FIRST_NAME.add("昆峰"); CN_FIRST_NAME.add("映秋"); CN_FIRST_NAME.add("璇子"); CN_FIRST_NAME.add("宾实"); CN_FIRST_NAME.add("含景"); CN_FIRST_NAME.add("芷荷"); CN_FIRST_NAME.add("柔蔓"); CN_FIRST_NAME.add("熙阳"); CN_FIRST_NAME.add("隽雅"); CN_FIRST_NAME.add("思琳"); CN_FIRST_NAME.add("勇军"); CN_FIRST_NAME.add("如意"); CN_FIRST_NAME.add("蕊珠"); CN_FIRST_NAME.add("依珊"); CN_FIRST_NAME.add("伟茂"); CN_FIRST_NAME.add("睿彤"); CN_FIRST_NAME.add("巧风"); CN_FIRST_NAME.add("振锐"); CN_FIRST_NAME.add("正雅"); CN_FIRST_NAME.add("添智"); CN_FIRST_NAME.add("雪兰"); CN_FIRST_NAME.add("向槐"); CN_FIRST_NAME.add("溪儿"); CN_FIRST_NAME.add("光耀"); CN_FIRST_NAME.add("从波"); CN_FIRST_NAME.add("晶辉"); CN_FIRST_NAME.add("学智"); CN_FIRST_NAME.add("秀妮"); CN_FIRST_NAME.add("鹏池"); CN_FIRST_NAME.add("曼彤"); CN_FIRST_NAME.add("灵秀"); CN_FIRST_NAME.add("雨凝"); CN_FIRST_NAME.add("敏博"); CN_FIRST_NAME.add("智伟"); CN_FIRST_NAME.add("凝丝"); CN_FIRST_NAME.add("海白"); CN_FIRST_NAME.add("新林"); CN_FIRST_NAME.add("康德"); CN_FIRST_NAME.add("博耘"); CN_FIRST_NAME.add("娟丽"); CN_FIRST_NAME.add("凝丹"); CN_FIRST_NAME.add("灵秋"); CN_FIRST_NAME.add("初晴"); CN_FIRST_NAME.add("唱月"); CN_FIRST_NAME.add("亦凝"); CN_FIRST_NAME.add("雨燕"); CN_FIRST_NAME.add("德惠"); CN_FIRST_NAME.add("巧夏"); CN_FIRST_NAME.add("娇然"); CN_FIRST_NAME.add("沛儿"); CN_FIRST_NAME.add("易容"); CN_FIRST_NAME.add("语晨"); CN_FIRST_NAME.add("寒香"); CN_FIRST_NAME.add("开霁"); CN_FIRST_NAME.add("高韵"); CN_FIRST_NAME.add("菀菀"); CN_FIRST_NAME.add("正真"); CN_FIRST_NAME.add("怡君"); CN_FIRST_NAME.add("春妤"); CN_FIRST_NAME.add("尔冬"); CN_FIRST_NAME.add("雪冰"); CN_FIRST_NAME.add("睿德"); CN_FIRST_NAME.add("冰双"); CN_FIRST_NAME.add("冰珍"); CN_FIRST_NAME.add("子楠"); CN_FIRST_NAME.add("顺慈"); CN_FIRST_NAME.add("嘉泽"); CN_FIRST_NAME.add("红艳"); CN_FIRST_NAME.add("迎丝"); CN_FIRST_NAME.add("鸿云"); CN_FIRST_NAME.add("晗玥"); CN_FIRST_NAME.add("秋颖"); CN_FIRST_NAME.add("晓君"); CN_FIRST_NAME.add("新柔"); CN_FIRST_NAME.add("山晴"); CN_FIRST_NAME.add("乐山"); CN_FIRST_NAME.add("贤惠"); CN_FIRST_NAME.add("吉欣"); CN_FIRST_NAME.add("菁菁"); CN_FIRST_NAME.add("俊人"); CN_FIRST_NAME.add("恬欣"); CN_FIRST_NAME.add("依琴"); CN_FIRST_NAME.add("星驰"); CN_FIRST_NAME.add("丹彤"); CN_FIRST_NAME.add("正青"); CN_FIRST_NAME.add("俏丽"); CN_FIRST_NAME.add("秀娟"); CN_FIRST_NAME.add("梓云"); CN_FIRST_NAME.add("春姝"); CN_FIRST_NAME.add("忆彤"); CN_FIRST_NAME.add("森莉"); CN_FIRST_NAME.add("海雪"); CN_FIRST_NAME.add("凝云"); CN_FIRST_NAME.add("青文"); CN_FIRST_NAME.add("嘉赐"); CN_FIRST_NAME.add("睿思"); CN_FIRST_NAME.add("依瑶"); CN_FIRST_NAME.add("佳妍"); CN_FIRST_NAME.add("初曼"); CN_FIRST_NAME.add("荣轩"); CN_FIRST_NAME.add("和安"); CN_FIRST_NAME.add("兴学"); CN_FIRST_NAME.add("敏叡"); CN_FIRST_NAME.add("寄容"); CN_FIRST_NAME.add("弘和"); CN_FIRST_NAME.add("红英"); CN_FIRST_NAME.add("凡之"); CN_FIRST_NAME.add("怡和"); CN_FIRST_NAME.add("雁露"); CN_FIRST_NAME.add("怡璐"); CN_FIRST_NAME.add("秀婉"); CN_FIRST_NAME.add("景焕"); CN_FIRST_NAME.add("雅隽"); CN_FIRST_NAME.add("春娇"); CN_FIRST_NAME.add("晓瑶"); CN_FIRST_NAME.add("孤松"); CN_FIRST_NAME.add("宏才"); CN_FIRST_NAME.add("浩壤"); CN_FIRST_NAME.add("巧香"); CN_FIRST_NAME.add("和宜"); CN_FIRST_NAME.add("琳晨"); CN_FIRST_NAME.add("幻枫"); CN_FIRST_NAME.add("兴安"); CN_FIRST_NAME.add("瀚文"); CN_FIRST_NAME.add("绢子"); CN_FIRST_NAME.add("幼枫"); CN_FIRST_NAME.add("半芹"); CN_FIRST_NAME.add("文赋"); CN_FIRST_NAME.add("欣彩"); CN_FIRST_NAME.add("青旋"); CN_FIRST_NAME.add("欣彤"); CN_FIRST_NAME.add("逸致"); CN_FIRST_NAME.add("沛凝"); CN_FIRST_NAME.add("晗琴"); CN_FIRST_NAME.add("心思"); CN_FIRST_NAME.add("晶灵"); CN_FIRST_NAME.add("茂学"); CN_FIRST_NAME.add("心怡"); CN_FIRST_NAME.add("翠岚"); CN_FIRST_NAME.add("宏扬"); CN_FIRST_NAME.add("冷玉"); CN_FIRST_NAME.add("运乾"); CN_FIRST_NAME.add("睿聪"); CN_FIRST_NAME.add("欣美"); CN_FIRST_NAME.add("长平"); CN_FIRST_NAME.add("诗槐"); CN_FIRST_NAME.add("茂实"); CN_FIRST_NAME.add("丹翠"); CN_FIRST_NAME.add("宇荫"); CN_FIRST_NAME.add("鹏赋"); CN_FIRST_NAME.add("浩大"); CN_FIRST_NAME.add("秀媛"); CN_FIRST_NAME.add("友卉"); CN_FIRST_NAME.add("秀媚"); CN_FIRST_NAME.add("以欣"); CN_FIRST_NAME.add("幼柏"); CN_FIRST_NAME.add("新梅"); CN_FIRST_NAME.add("清昶"); CN_FIRST_NAME.add("嘉淑"); CN_FIRST_NAME.add("凯泽"); CN_FIRST_NAME.add("雅霜"); CN_FIRST_NAME.add("韫玉"); CN_FIRST_NAME.add("傲南"); CN_FIRST_NAME.add("叶丰"); CN_FIRST_NAME.add("初蝶"); CN_FIRST_NAME.add("听枫"); CN_FIRST_NAME.add("升荣"); CN_FIRST_NAME.add("香彤"); CN_FIRST_NAME.add("欣德"); CN_FIRST_NAME.add("芳蔼"); CN_FIRST_NAME.add("学林"); CN_FIRST_NAME.add("冷珍"); CN_FIRST_NAME.add("清晖"); CN_FIRST_NAME.add("夜云"); CN_FIRST_NAME.add("天泽"); CN_FIRST_NAME.add("芳蕤"); CN_FIRST_NAME.add("问儿"); CN_FIRST_NAME.add("驰文"); CN_FIRST_NAME.add("华芝"); CN_FIRST_NAME.add("安荷"); CN_FIRST_NAME.add("昆鹏"); CN_FIRST_NAME.add("飞阳"); CN_FIRST_NAME.add("叶丹"); CN_FIRST_NAME.add("白翠"); CN_FIRST_NAME.add("盈盈"); CN_FIRST_NAME.add("康胜"); CN_FIRST_NAME.add("痴灵"); CN_FIRST_NAME.add("若彤"); CN_FIRST_NAME.add("玉宇"); CN_FIRST_NAME.add("访波"); CN_FIRST_NAME.add("青易"); CN_FIRST_NAME.add("成天"); CN_FIRST_NAME.add("高飞"); CN_FIRST_NAME.add("芳蕙"); CN_FIRST_NAME.add("芷蓝"); CN_FIRST_NAME.add("鸿轩"); CN_FIRST_NAME.add("梦泽"); CN_FIRST_NAME.add("鹏海"); CN_FIRST_NAME.add("傲玉"); CN_FIRST_NAME.add("俊侠"); CN_FIRST_NAME.add("成礼"); CN_FIRST_NAME.add("美曼"); CN_FIRST_NAME.add("从丹"); CN_FIRST_NAME.add("醉香"); CN_FIRST_NAME.add("幻桃"); CN_FIRST_NAME.add("瀚昂"); CN_FIRST_NAME.add("雅静"); CN_FIRST_NAME.add("凌兰"); CN_FIRST_NAME.add("山蝶"); CN_FIRST_NAME.add("蓉蓉"); CN_FIRST_NAME.add("永年"); CN_FIRST_NAME.add("俊迈"); CN_FIRST_NAME.add("三春"); CN_FIRST_NAME.add("秀竹"); CN_FIRST_NAME.add("双玉"); CN_FIRST_NAME.add("恬谧"); CN_FIRST_NAME.add("语蝶"); CN_FIRST_NAME.add("骊艳"); CN_FIRST_NAME.add("俊达"); CN_FIRST_NAME.add("鹏涛"); CN_FIRST_NAME.add("雅青"); CN_FIRST_NAME.add("玉宸"); CN_FIRST_NAME.add("安莲"); CN_FIRST_NAME.add("星宇"); CN_FIRST_NAME.add("贞芳"); CN_FIRST_NAME.add("怡畅"); CN_FIRST_NAME.add("天赋"); CN_FIRST_NAME.add("鸿达"); CN_FIRST_NAME.add("飞白"); CN_FIRST_NAME.add("珊珊"); CN_FIRST_NAME.add("问兰"); CN_FIRST_NAME.add("震轩"); CN_FIRST_NAME.add("欣怡"); CN_FIRST_NAME.add("友珊"); CN_FIRST_NAME.add("宏茂"); CN_FIRST_NAME.add("俊远"); CN_FIRST_NAME.add("书竹"); CN_FIRST_NAME.add("语林"); CN_FIRST_NAME.add("初柔"); CN_FIRST_NAME.add("晓畅"); CN_FIRST_NAME.add("嘉丽"); CN_FIRST_NAME.add("淑贞"); CN_FIRST_NAME.add("幻梅"); CN_FIRST_NAME.add("哲瀚"); CN_FIRST_NAME.add("鸿运"); CN_FIRST_NAME.add("映安"); CN_FIRST_NAME.add("又琴"); CN_FIRST_NAME.add("昆纬"); CN_FIRST_NAME.add("鸿远"); CN_FIRST_NAME.add("可佳"); CN_FIRST_NAME.add("靖易"); CN_FIRST_NAME.add("欣怿"); CN_FIRST_NAME.add("永康"); CN_FIRST_NAME.add("含桃"); CN_FIRST_NAME.add("雨华"); CN_FIRST_NAME.add("春竹"); CN_FIRST_NAME.add("翰学"); CN_FIRST_NAME.add("昆纶"); CN_FIRST_NAME.add("初柳"); CN_FIRST_NAME.add("雨南"); CN_FIRST_NAME.add("淑贤"); CN_FIRST_NAME.add("华茂"); CN_FIRST_NAME.add("晴照"); CN_FIRST_NAME.add("元良"); CN_FIRST_NAME.add("思嘉"); CN_FIRST_NAME.add("丽思"); CN_FIRST_NAME.add("雍雅"); CN_FIRST_NAME.add("从云"); CN_FIRST_NAME.add("若翠"); CN_FIRST_NAME.add("雪卉"); CN_FIRST_NAME.add("烨赫"); CN_FIRST_NAME.add("鸿信"); CN_FIRST_NAME.add("小珍"); CN_FIRST_NAME.add("凝远"); CN_FIRST_NAME.add("语柔"); CN_FIRST_NAME.add("文丽"); CN_FIRST_NAME.add("怜阳"); CN_FIRST_NAME.add("乐巧"); CN_FIRST_NAME.add("芷文"); CN_FIRST_NAME.add("振国"); CN_FIRST_NAME.add("半莲"); CN_FIRST_NAME.add("嘉云"); CN_FIRST_NAME.add("俊逸"); CN_FIRST_NAME.add("文乐"); CN_FIRST_NAME.add("修诚"); CN_FIRST_NAME.add("睿慈"); CN_FIRST_NAME.add("丝萝"); CN_FIRST_NAME.add("山柳"); CN_FIRST_NAME.add("音华"); CN_FIRST_NAME.add("亦玉"); CN_FIRST_NAME.add("秀筠"); CN_FIRST_NAME.add("妙思"); CN_FIRST_NAME.add("经纬"); CN_FIRST_NAME.add("骊英"); CN_FIRST_NAME.add("语柳"); CN_FIRST_NAME.add("灵安"); CN_FIRST_NAME.add("端雅"); CN_FIRST_NAME.add("慧丽"); CN_FIRST_NAME.add("夏烟"); CN_FIRST_NAME.add("问凝"); CN_FIRST_NAME.add("水彤"); CN_FIRST_NAME.add("映寒"); CN_FIRST_NAME.add("西华"); CN_FIRST_NAME.add("芳春"); CN_FIRST_NAME.add("雅韵"); CN_FIRST_NAME.add("安萱"); CN_FIRST_NAME.add("友琴"); CN_FIRST_NAME.add("心愫"); CN_FIRST_NAME.add("雅韶"); CN_FIRST_NAME.add("珉瑶"); CN_FIRST_NAME.add("炳君"); CN_FIRST_NAME.add("经纶"); CN_FIRST_NAME.add("欢悦"); CN_FIRST_NAME.add("旎旎"); CN_FIRST_NAME.add("霓云"); CN_FIRST_NAME.add("真洁"); CN_FIRST_NAME.add("俊健"); CN_FIRST_NAME.add("鸣玉"); CN_FIRST_NAME.add("子欣"); CN_FIRST_NAME.add("飞雨"); CN_FIRST_NAME.add("鹏举"); CN_FIRST_NAME.add("元芹"); CN_FIRST_NAME.add("飞雪"); CN_FIRST_NAME.add("华荣"); CN_FIRST_NAME.add("乃心"); CN_FIRST_NAME.add("天路"); CN_FIRST_NAME.add("欣悦"); CN_FIRST_NAME.add("心慈"); CN_FIRST_NAME.add("弘阔"); CN_FIRST_NAME.add("灵寒"); CN_FIRST_NAME.add("修谨"); CN_FIRST_NAME.add("世敏"); CN_FIRST_NAME.add("瑞芝"); CN_FIRST_NAME.add("海颖"); CN_FIRST_NAME.add("温茂"); CN_FIRST_NAME.add("英纵"); CN_FIRST_NAME.add("雨双"); CN_FIRST_NAME.add("雨珍"); CN_FIRST_NAME.add("青曼"); CN_FIRST_NAME.add("盼兰"); CN_FIRST_NAME.add("梓倩"); CN_FIRST_NAME.add("力夫"); CN_FIRST_NAME.add("骊茹"); CN_FIRST_NAME.add("绿夏"); CN_FIRST_NAME.add("锐泽"); CN_FIRST_NAME.add("修永"); CN_FIRST_NAME.add("友瑶"); CN_FIRST_NAME.add("怡嘉"); CN_FIRST_NAME.add("元英"); CN_FIRST_NAME.add("玉山"); CN_FIRST_NAME.add("慧云"); CN_FIRST_NAME.add("古兰"); CN_FIRST_NAME.add("翠巧"); CN_FIRST_NAME.add("韶华"); CN_FIRST_NAME.add("小琴"); CN_FIRST_NAME.add("珑玲"); CN_FIRST_NAME.add("彗云"); CN_FIRST_NAME.add("玄素"); CN_FIRST_NAME.add("晶燕"); CN_FIRST_NAME.add("新觉"); CN_FIRST_NAME.add("月怡"); CN_FIRST_NAME.add("娴淑"); CN_FIRST_NAME.add("霞赩"); CN_FIRST_NAME.add("瑜英"); CN_FIRST_NAME.add("贝莉"); CN_FIRST_NAME.add("国兴"); CN_FIRST_NAME.add("恺歌"); CN_FIRST_NAME.add("素华"); CN_FIRST_NAME.add("小瑜"); CN_FIRST_NAME.add("曜文"); CN_FIRST_NAME.add("浩穰"); CN_FIRST_NAME.add("雯华"); CN_FIRST_NAME.add("碧巧"); CN_FIRST_NAME.add("河灵"); CN_FIRST_NAME.add("娅玟"); CN_FIRST_NAME.add("雪珍"); CN_FIRST_NAME.add("鹏云"); CN_FIRST_NAME.add("雪珊"); CN_FIRST_NAME.add("康成"); CN_FIRST_NAME.add("易巧"); CN_FIRST_NAME.add("艳丽"); CN_FIRST_NAME.add("梦丝"); CN_FIRST_NAME.add("静晨"); CN_FIRST_NAME.add("雁风"); CN_FIRST_NAME.add("山梅"); CN_FIRST_NAME.add("珍瑞"); CN_FIRST_NAME.add("怜雪"); CN_FIRST_NAME.add("思雅"); CN_FIRST_NAME.add("寻雪"); CN_FIRST_NAME.add("端静"); CN_FIRST_NAME.add("志强"); CN_FIRST_NAME.add("语梦"); CN_FIRST_NAME.add("思雁"); CN_FIRST_NAME.add("正奇"); CN_FIRST_NAME.add("夏兰"); CN_FIRST_NAME.add("宾鸿"); CN_FIRST_NAME.add("欣愉"); CN_FIRST_NAME.add("凯乐"); CN_FIRST_NAME.add("文滨"); CN_FIRST_NAME.add("昌黎"); CN_FIRST_NAME.add("俊郎"); CN_FIRST_NAME.add("苒苒"); CN_FIRST_NAME.add("骏英"); CN_FIRST_NAME.add("承泽"); CN_FIRST_NAME.add("笑卉"); CN_FIRST_NAME.add("涵煦"); CN_FIRST_NAME.add("雨琴"); CN_FIRST_NAME.add("采南"); CN_FIRST_NAME.add("嘉佑"); CN_FIRST_NAME.add("思雨"); CN_FIRST_NAME.add("痴凝"); CN_FIRST_NAME.add("梦之"); CN_FIRST_NAME.add("笑南"); CN_FIRST_NAME.add("博艺"); CN_FIRST_NAME.add("愉婉"); CN_FIRST_NAME.add("乐康"); CN_FIRST_NAME.add("正祥"); CN_FIRST_NAME.add("念寒"); CN_FIRST_NAME.add("辰君"); CN_FIRST_NAME.add("自强"); CN_FIRST_NAME.add("沛珊"); CN_FIRST_NAME.add("英彦"); CN_FIRST_NAME.add("依白"); CN_FIRST_NAME.add("青枫"); CN_FIRST_NAME.add("高驰"); CN_FIRST_NAME.add("驰月"); CN_FIRST_NAME.add("文漪"); CN_FIRST_NAME.add("月悦"); CN_FIRST_NAME.add("家美"); CN_FIRST_NAME.add("天亦"); CN_FIRST_NAME.add("谷翠"); CN_FIRST_NAME.add("妙意"); CN_FIRST_NAME.add("冬雁"); CN_FIRST_NAME.add("睿才"); CN_FIRST_NAME.add("弘雅"); CN_FIRST_NAME.add("惠美"); CN_FIRST_NAME.add("梦云"); CN_FIRST_NAME.add("云霞"); CN_FIRST_NAME.add("尔琴"); CN_FIRST_NAME.add("思真"); CN_FIRST_NAME.add("嘉澍"); CN_FIRST_NAME.add("青柏"); CN_FIRST_NAME.add("锦欣"); CN_FIRST_NAME.add("司辰"); CN_FIRST_NAME.add("冬雪"); CN_FIRST_NAME.add("弘益"); CN_FIRST_NAME.add("凡灵"); CN_FIRST_NAME.add("茹雪"); CN_FIRST_NAME.add("弘盛"); CN_FIRST_NAME.add("同济"); CN_FIRST_NAME.add("子民"); CN_FIRST_NAME.add("云露"); CN_FIRST_NAME.add("辰钊"); CN_FIRST_NAME.add("妍芳"); CN_FIRST_NAME.add("文轩"); CN_FIRST_NAME.add("真一"); CN_FIRST_NAME.add("骊萍"); CN_FIRST_NAME.add("静曼"); CN_FIRST_NAME.add("海女"); CN_FIRST_NAME.add("修洁"); CN_FIRST_NAME.add("丰茂"); CN_FIRST_NAME.add("雪瑶"); CN_FIRST_NAME.add("娜兰"); CN_FIRST_NAME.add("永怡"); CN_FIRST_NAME.add("晏静"); CN_FIRST_NAME.add("永思"); CN_FIRST_NAME.add("恨之"); CN_FIRST_NAME.add("姗姗"); CN_FIRST_NAME.add("甘泽"); CN_FIRST_NAME.add("宇文"); CN_FIRST_NAME.add("智刚"); CN_FIRST_NAME.add("弘图"); CN_FIRST_NAME.add("嘉运"); CN_FIRST_NAME.add("惠心"); CN_FIRST_NAME.add("采珊"); CN_FIRST_NAME.add("凝然"); CN_FIRST_NAME.add("奇正"); CN_FIRST_NAME.add("鸿煊"); CN_FIRST_NAME.add("鸿光"); CN_FIRST_NAME.add("修贤"); CN_FIRST_NAME.add("水悦"); CN_FIRST_NAME.add("竹雨"); CN_FIRST_NAME.add("元菱"); CN_FIRST_NAME.add("翠绿"); CN_FIRST_NAME.add("善思"); CN_FIRST_NAME.add("依霜"); CN_FIRST_NAME.add("珺俐"); CN_FIRST_NAME.add("春岚"); CN_FIRST_NAME.add("蓓蕾"); CN_FIRST_NAME.add("伟晔"); CN_FIRST_NAME.add("雯君"); CN_FIRST_NAME.add("恨云"); CN_FIRST_NAME.add("勇锐"); CN_FIRST_NAME.add("慕凝"); CN_FIRST_NAME.add("晨璐"); CN_FIRST_NAME.add("晓霜"); CN_FIRST_NAME.add("鸿熙"); CN_FIRST_NAME.add("靖柏"); CN_FIRST_NAME.add("良俊"); CN_FIRST_NAME.add("靖柔"); CN_FIRST_NAME.add("辰铭"); CN_FIRST_NAME.add("建章"); CN_FIRST_NAME.add("沈雅"); CN_FIRST_NAME.add("南莲"); CN_FIRST_NAME.add("晓露"); CN_FIRST_NAME.add("悠柔"); CN_FIRST_NAME.add("仙仪"); CN_FIRST_NAME.add("海秋"); CN_FIRST_NAME.add("烨伟"); CN_FIRST_NAME.add("千易"); CN_FIRST_NAME.add("可儿"); CN_FIRST_NAME.add("彭泽"); CN_FIRST_NAME.add("英耀"); CN_FIRST_NAME.add("易绿"); CN_FIRST_NAME.add("浩宕"); CN_FIRST_NAME.add("合乐"); CN_FIRST_NAME.add("天佑"); CN_FIRST_NAME.add("晨钰"); CN_FIRST_NAME.add("饮月"); CN_FIRST_NAME.add("问玉"); CN_FIRST_NAME.add("姝好"); CN_FIRST_NAME.add("绮山"); CN_FIRST_NAME.add("慧俊"); CN_FIRST_NAME.add("芳林"); CN_FIRST_NAME.add("玮奇"); CN_FIRST_NAME.add("勇男"); CN_FIRST_NAME.add("品韵"); CN_FIRST_NAME.add("静枫"); CN_FIRST_NAME.add("锦诗"); CN_FIRST_NAME.add("琇云"); CN_FIRST_NAME.add("凝冬"); CN_FIRST_NAME.add("冰真"); CN_FIRST_NAME.add("明德"); CN_FIRST_NAME.add("雅香"); CN_FIRST_NAME.add("自怡"); CN_FIRST_NAME.add("昌翰"); CN_FIRST_NAME.add("秋寒"); CN_FIRST_NAME.add("睿范"); CN_FIRST_NAME.add("骊蓉"); CN_FIRST_NAME.add("和平"); CN_FIRST_NAME.add("从灵"); CN_FIRST_NAME.add("滢渟"); CN_FIRST_NAME.add("景同"); CN_FIRST_NAME.add("鹏运"); CN_FIRST_NAME.add("悦来"); CN_FIRST_NAME.add("凡儿"); CN_FIRST_NAME.add("山槐"); CN_FIRST_NAME.add("兴平"); CN_FIRST_NAME.add("承业"); CN_FIRST_NAME.add("乐心"); CN_FIRST_NAME.add("晗雨"); CN_FIRST_NAME.add("半蕾"); CN_FIRST_NAME.add("辰锟"); CN_FIRST_NAME.add("智勇"); CN_FIRST_NAME.add("滨海"); CN_FIRST_NAME.add("颖慧"); CN_FIRST_NAME.add("紫南"); CN_FIRST_NAME.add("静柏"); CN_FIRST_NAME.add("宏放"); CN_FIRST_NAME.add("红旭"); CN_FIRST_NAME.add("明志"); CN_FIRST_NAME.add("曜曦"); CN_FIRST_NAME.add("青梦"); CN_FIRST_NAME.add("雅秀"); CN_FIRST_NAME.add("如蓉"); CN_FIRST_NAME.add("乐志"); CN_FIRST_NAME.add("闲华"); CN_FIRST_NAME.add("云韶"); CN_FIRST_NAME.add("芷蝶"); CN_FIRST_NAME.add("代丝"); CN_FIRST_NAME.add("言文"); CN_FIRST_NAME.add("兴庆"); CN_FIRST_NAME.add("安易"); CN_FIRST_NAME.add("真仪"); CN_FIRST_NAME.add("君豪"); CN_FIRST_NAME.add("彤云"); CN_FIRST_NAME.add("珠玉"); CN_FIRST_NAME.add("飞飙"); CN_FIRST_NAME.add("宛菡"); CN_FIRST_NAME.add("彭越"); CN_FIRST_NAME.add("紫玉"); CN_FIRST_NAME.add("流惠"); CN_FIRST_NAME.add("安春"); CN_FIRST_NAME.add("俊爽"); CN_FIRST_NAME.add("欣艳"); CN_FIRST_NAME.add("沈靖"); CN_FIRST_NAME.add("建安"); CN_FIRST_NAME.add("奇水"); CN_FIRST_NAME.add("金玉"); CN_FIRST_NAME.add("绿竹"); CN_FIRST_NAME.add("乐怡"); CN_FIRST_NAME.add("怀寒"); CN_FIRST_NAME.add("沈静"); CN_FIRST_NAME.add("英悟"); CN_FIRST_NAME.add("冷雁"); CN_FIRST_NAME.add("高寒"); CN_FIRST_NAME.add("安晏"); CN_FIRST_NAME.add("浓绮"); CN_FIRST_NAME.add("盈秀"); CN_FIRST_NAME.add("瑜蓓"); CN_FIRST_NAME.add("以丹"); CN_FIRST_NAME.add("运凡"); CN_FIRST_NAME.add("傲白"); CN_FIRST_NAME.add("姣妍"); CN_FIRST_NAME.add("修为"); CN_FIRST_NAME.add("运凯"); CN_FIRST_NAME.add("竹韵"); CN_FIRST_NAME.add("俊力"); CN_FIRST_NAME.add("冷雪"); CN_FIRST_NAME.add("醉山"); CN_FIRST_NAME.add("星鹏"); CN_FIRST_NAME.add("雅娴"); CN_FIRST_NAME.add("丽芳"); CN_FIRST_NAME.add("虹玉"); CN_FIRST_NAME.add("力学"); CN_FIRST_NAME.add("菀柳"); CN_FIRST_NAME.add("天逸"); CN_FIRST_NAME.add("囡囡"); CN_FIRST_NAME.add("妙芙"); CN_FIRST_NAME.add("骊文"); CN_FIRST_NAME.add("新语"); CN_FIRST_NAME.add("知睿"); CN_FIRST_NAME.add("景铄"); CN_FIRST_NAME.add("霞辉"); CN_FIRST_NAME.add("宏旷"); CN_FIRST_NAME.add("以云"); CN_FIRST_NAME.add("才哲"); CN_FIRST_NAME.add("华藏"); CN_FIRST_NAME.add("君洁"); CN_FIRST_NAME.add("滢滢"); CN_FIRST_NAME.add("曦晨"); CN_FIRST_NAME.add("冷霜"); CN_FIRST_NAME.add("香芹"); CN_FIRST_NAME.add("南蓉"); CN_FIRST_NAME.add("浩岚"); CN_FIRST_NAME.add("乐悦"); CN_FIRST_NAME.add("星纬"); CN_FIRST_NAME.add("彭丹"); CN_FIRST_NAME.add("云飞"); CN_FIRST_NAME.add("雅媚"); CN_FIRST_NAME.add("姣姣"); CN_FIRST_NAME.add("叶农"); CN_FIRST_NAME.add("菊月"); CN_FIRST_NAME.add("傲雪"); CN_FIRST_NAME.add("温文"); CN_FIRST_NAME.add("怀山"); CN_FIRST_NAME.add("瑜敏"); CN_FIRST_NAME.add("彭湃"); CN_FIRST_NAME.add("紫琼"); CN_FIRST_NAME.add("若芳"); CN_FIRST_NAME.add("又青"); CN_FIRST_NAME.add("心菱"); CN_FIRST_NAME.add("英慧"); CN_FIRST_NAME.add("和美"); CN_FIRST_NAME.add("开宇"); CN_FIRST_NAME.add("辰阳"); CN_FIRST_NAME.add("尔阳"); CN_FIRST_NAME.add("寄翠"); CN_FIRST_NAME.add("从冬"); CN_FIRST_NAME.add("慕卉"); CN_FIRST_NAME.add("念巧"); CN_FIRST_NAME.add("傲霜"); CN_FIRST_NAME.add("曜栋"); CN_FIRST_NAME.add("婉淑"); CN_FIRST_NAME.add("君浩"); CN_FIRST_NAME.add("思天"); CN_FIRST_NAME.add("项明"); CN_FIRST_NAME.add("金鑫"); CN_FIRST_NAME.add("高岑"); CN_FIRST_NAME.add("欣荣"); CN_FIRST_NAME.add("文光"); CN_FIRST_NAME.add("童童"); CN_FIRST_NAME.add("云天"); CN_FIRST_NAME.add("小雨"); CN_FIRST_NAME.add("茂彦"); CN_FIRST_NAME.add("乐意"); CN_FIRST_NAME.add("嘉熙"); CN_FIRST_NAME.add("若英"); CN_FIRST_NAME.add("锐达"); CN_FIRST_NAME.add("和志"); CN_FIRST_NAME.add("华晖"); CN_FIRST_NAME.add("从凝"); CN_FIRST_NAME.add("逸明"); CN_FIRST_NAME.add("鹏煊"); CN_FIRST_NAME.add("兴德"); CN_FIRST_NAME.add("燕珺"); CN_FIRST_NAME.add("小雯"); CN_FIRST_NAME.add("晶瑶"); CN_FIRST_NAME.add("承载"); CN_FIRST_NAME.add("烨烁"); CN_FIRST_NAME.add("婉清"); CN_FIRST_NAME.add("锐进"); CN_FIRST_NAME.add("曲文"); CN_FIRST_NAME.add("依风"); CN_FIRST_NAME.add("白莲"); CN_FIRST_NAME.add("弘壮"); CN_FIRST_NAME.add("刚毅"); CN_FIRST_NAME.add("元旋"); CN_FIRST_NAME.add("子丹"); CN_FIRST_NAME.add("尔白"); CN_FIRST_NAME.add("芊丽"); CN_FIRST_NAME.add("茂德"); CN_FIRST_NAME.add("小霜"); CN_FIRST_NAME.add("海宁"); CN_FIRST_NAME.add("鸿卓"); CN_FIRST_NAME.add("鸿博"); CN_FIRST_NAME.add("韶阳"); CN_FIRST_NAME.add("辰皓"); CN_FIRST_NAME.add("波涛"); CN_FIRST_NAME.add("修伟"); CN_FIRST_NAME.add("贝晨"); CN_FIRST_NAME.add("千柔"); CN_FIRST_NAME.add("逸春"); CN_FIRST_NAME.add("咏德"); CN_FIRST_NAME.add("觅丹"); CN_FIRST_NAME.add("高峯"); CN_FIRST_NAME.add("弘大"); CN_FIRST_NAME.add("歆美"); CN_FIRST_NAME.add("兴怀"); CN_FIRST_NAME.add("水芸"); CN_FIRST_NAME.add("高峰"); CN_FIRST_NAME.add("痴瑶"); CN_FIRST_NAME.add("晟睿"); CN_FIRST_NAME.add("南蕾"); CN_FIRST_NAME.add("烨烨"); CN_FIRST_NAME.add("雨雪"); CN_FIRST_NAME.add("晓夏"); CN_FIRST_NAME.add("访烟"); CN_FIRST_NAME.add("微月"); CN_FIRST_NAME.add("丹萱"); CN_FIRST_NAME.add("千柳"); CN_FIRST_NAME.add("密思"); CN_FIRST_NAME.add("恺乐"); CN_FIRST_NAME.add("阳波"); CN_FIRST_NAME.add("婉丽"); CN_FIRST_NAME.add("和怡"); CN_FIRST_NAME.add("晏如"); CN_FIRST_NAME.add("震博"); CN_FIRST_NAME.add("元明"); CN_FIRST_NAME.add("咏志"); CN_FIRST_NAME.add("兴思"); CN_FIRST_NAME.add("雨真"); CN_FIRST_NAME.add("香莲"); CN_FIRST_NAME.add("以轩"); CN_FIRST_NAME.add("高峻"); CN_FIRST_NAME.add("天元"); CN_FIRST_NAME.add("阳泽"); CN_FIRST_NAME.add("锐逸"); CN_FIRST_NAME.add("尔雅"); CN_FIRST_NAME.add("德明"); CN_FIRST_NAME.add("承运"); CN_FIRST_NAME.add("智鑫"); CN_FIRST_NAME.add("德昌"); CN_FIRST_NAME.add("玉龙"); CN_FIRST_NAME.add("博敏"); CN_FIRST_NAME.add("烨然"); CN_FIRST_NAME.add("职君"); CN_FIRST_NAME.add("飞驰"); CN_FIRST_NAME.add("俊友"); CN_FIRST_NAME.add("晴画"); CN_FIRST_NAME.add("夏瑶"); CN_FIRST_NAME.add("允晨"); CN_FIRST_NAME.add("笑阳"); CN_FIRST_NAME.add("雅宁"); CN_FIRST_NAME.add("俊发"); CN_FIRST_NAME.add("沛白"); CN_FIRST_NAME.add("惜芹"); CN_FIRST_NAME.add("诗丹"); CN_FIRST_NAME.add("夏璇"); CN_FIRST_NAME.add("冰夏"); CN_FIRST_NAME.add("红螺"); CN_FIRST_NAME.add("迎南"); CN_FIRST_NAME.add("白萱"); CN_FIRST_NAME.add("子亦"); CN_FIRST_NAME.add("新洁"); CN_FIRST_NAME.add("学民"); CN_FIRST_NAME.add("沙雨"); CN_FIRST_NAME.add("湛恩"); CN_FIRST_NAME.add("妙菡"); CN_FIRST_NAME.add("宏朗"); CN_FIRST_NAME.add("咏思"); CN_FIRST_NAME.add("运升"); CN_FIRST_NAME.add("博文"); CN_FIRST_NAME.add("香菱"); CN_FIRST_NAME.add("英才"); CN_FIRST_NAME.add("涵瑶"); CN_FIRST_NAME.add("安柏"); CN_FIRST_NAME.add("情文"); CN_FIRST_NAME.add("运华"); CN_FIRST_NAME.add("醉巧"); CN_FIRST_NAME.add("华月"); CN_FIRST_NAME.add("访儿"); CN_FIRST_NAME.add("谷芹"); CN_FIRST_NAME.add("秋巧"); CN_FIRST_NAME.add("雅安"); CN_FIRST_NAME.add("春绿"); CN_FIRST_NAME.add("烨煜"); CN_FIRST_NAME.add("觅云"); CN_FIRST_NAME.add("丝柳"); CN_FIRST_NAME.add("信然"); CN_FIRST_NAME.add("梓玥"); CN_FIRST_NAME.add("尔真"); CN_FIRST_NAME.add("采白"); CN_FIRST_NAME.add("经艺"); CN_FIRST_NAME.add("静槐"); CN_FIRST_NAME.add("雅容"); CN_FIRST_NAME.add("梦兰"); CN_FIRST_NAME.add("君丽"); CN_FIRST_NAME.add("蕴和"); CN_FIRST_NAME.add("淑然"); CN_FIRST_NAME.add("和悌"); CN_FIRST_NAME.add("俊名"); CN_FIRST_NAME.add("琛丽"); CN_FIRST_NAME.add("和悦"); CN_FIRST_NAME.add("思娜"); CN_FIRST_NAME.add("望慕"); CN_FIRST_NAME.add("鹤轩"); CN_FIRST_NAME.add("凝珍"); CN_FIRST_NAME.add("君之"); CN_FIRST_NAME.add("梓珊"); CN_FIRST_NAME.add("刚豪"); CN_FIRST_NAME.add("语诗"); CN_FIRST_NAME.add("曼蔓"); CN_FIRST_NAME.add("暄玲"); CN_FIRST_NAME.add("修远"); CN_FIRST_NAME.add("善芳"); CN_FIRST_NAME.add("夜卉"); CN_FIRST_NAME.add("香萱"); CN_FIRST_NAME.add("夜南"); CN_FIRST_NAME.add("如曼"); CN_FIRST_NAME.add("淑兰"); CN_FIRST_NAME.add("馥芬"); CN_FIRST_NAME.add("玉怡"); CN_FIRST_NAME.add("烨熠"); CN_FIRST_NAME.add("施诗"); CN_FIRST_NAME.add("沛雯"); CN_FIRST_NAME.add("若菱"); CN_FIRST_NAME.add("睿敏"); CN_FIRST_NAME.add("雅寒"); CN_FIRST_NAME.add("秀美"); CN_FIRST_NAME.add("雁山"); CN_FIRST_NAME.add("依秋"); CN_FIRST_NAME.add("彦灵"); CN_FIRST_NAME.add("乐成"); CN_FIRST_NAME.add("婉仪"); CN_FIRST_NAME.add("水荷"); CN_FIRST_NAME.add("泰河"); CN_FIRST_NAME.add("飞章"); CN_FIRST_NAME.add("访冬"); CN_FIRST_NAME.add("冰香"); CN_FIRST_NAME.add("睿文"); CN_FIRST_NAME.add("夜玉"); CN_FIRST_NAME.add("嘉勋"); CN_FIRST_NAME.add("可可"); CN_FIRST_NAME.add("和惬"); CN_FIRST_NAME.add("凯凯"); CN_FIRST_NAME.add("运珊"); CN_FIRST_NAME.add("冠宇"); CN_FIRST_NAME.add("光明"); CN_FIRST_NAME.add("翰翮"); CN_FIRST_NAME.add("笑雯"); CN_FIRST_NAME.add("巧绿"); CN_FIRST_NAME.add("博易"); CN_FIRST_NAME.add("梓琬"); CN_FIRST_NAME.add("南晴"); CN_FIRST_NAME.add("梦凡"); CN_FIRST_NAME.add("代灵"); CN_FIRST_NAME.add("姮娥"); CN_FIRST_NAME.add("凝琴"); CN_FIRST_NAME.add("博明"); CN_FIRST_NAME.add("娅静"); CN_FIRST_NAME.add("凡双"); CN_FIRST_NAME.add("宜春"); CN_FIRST_NAME.add("运珧"); CN_FIRST_NAME.add("曼文"); CN_FIRST_NAME.add("长莹"); CN_FIRST_NAME.add("桂帆"); CN_FIRST_NAME.add("德曜"); CN_FIRST_NAME.add("昊苍"); CN_FIRST_NAME.add("运发"); CN_FIRST_NAME.add("子轩"); CN_FIRST_NAME.add("康时"); CN_FIRST_NAME.add("雨石"); CN_FIRST_NAME.add("毅然"); CN_FIRST_NAME.add("英范"); CN_FIRST_NAME.add("芮欢"); CN_FIRST_NAME.add("芮欣"); CN_FIRST_NAME.add("辰韦"); CN_FIRST_NAME.add("明艳"); CN_FIRST_NAME.add("昊英"); CN_FIRST_NAME.add("理全"); CN_FIRST_NAME.add("刚洁"); CN_FIRST_NAME.add("长菁"); CN_FIRST_NAME.add("振宇"); CN_FIRST_NAME.add("平乐"); CN_FIRST_NAME.add("安梦"); CN_FIRST_NAME.add("立群"); CN_FIRST_NAME.add("如松"); CN_FIRST_NAME.add("运珹"); CN_FIRST_NAME.add("绮彤"); CN_FIRST_NAME.add("浩广"); CN_FIRST_NAME.add("涵畅"); CN_FIRST_NAME.add("忆敏"); CN_FIRST_NAME.add("恬然"); CN_FIRST_NAME.add("又夏"); CN_FIRST_NAME.add("梓瑶"); CN_FIRST_NAME.add("菲菲"); CN_FIRST_NAME.add("梓璐"); CN_FIRST_NAME.add("银瑶"); CN_FIRST_NAME.add("春翠"); CN_FIRST_NAME.add("望舒"); CN_FIRST_NAME.add("德本"); CN_FIRST_NAME.add("思嫒"); CN_FIRST_NAME.add("乐芸"); CN_FIRST_NAME.add("睿明"); CN_FIRST_NAME.add("俊哲"); CN_FIRST_NAME.add("腾逸"); CN_FIRST_NAME.add("子辰"); CN_FIRST_NAME.add("绮美"); CN_FIRST_NAME.add("妍晨"); CN_FIRST_NAME.add("音韵"); CN_FIRST_NAME.add("半梅"); CN_FIRST_NAME.add("佳美"); CN_FIRST_NAME.add("昌茂"); CN_FIRST_NAME.add("飞宇"); CN_FIRST_NAME.add("鸿哲"); CN_FIRST_NAME.add("兴腾"); CN_FIRST_NAME.add("喜悦"); CN_FIRST_NAME.add("问雁"); CN_FIRST_NAME.add("暄和"); CN_FIRST_NAME.add("如柏"); CN_FIRST_NAME.add("斯乔"); CN_FIRST_NAME.add("忆文"); CN_FIRST_NAME.add("谷菱"); CN_FIRST_NAME.add("赞怡"); CN_FIRST_NAME.add("凌雪"); CN_FIRST_NAME.add("子濯"); CN_FIRST_NAME.add("新之"); CN_FIRST_NAME.add("元蝶"); CN_FIRST_NAME.add("泽语"); CN_FIRST_NAME.add("白薇"); CN_FIRST_NAME.add("含海"); CN_FIRST_NAME.add("晓骞"); CN_FIRST_NAME.add("馨荣"); CN_FIRST_NAME.add("乐英"); CN_FIRST_NAME.add("嘉玉"); CN_FIRST_NAME.add("念念"); CN_FIRST_NAME.add("文华"); CN_FIRST_NAME.add("阳云"); CN_FIRST_NAME.add("樱花"); CN_FIRST_NAME.add("承允"); CN_FIRST_NAME.add("苑杰"); CN_FIRST_NAME.add("奇伟"); CN_FIRST_NAME.add("从珊"); CN_FIRST_NAME.add("翠芙"); CN_FIRST_NAME.add("同光"); CN_FIRST_NAME.add("泽民"); CN_FIRST_NAME.add("惜萍"); CN_FIRST_NAME.add("元枫"); CN_FIRST_NAME.add("宛曼"); CN_FIRST_NAME.add("彬炳"); CN_FIRST_NAME.add("野雪"); CN_FIRST_NAME.add("隽巧"); CN_FIRST_NAME.add("彬郁"); CN_FIRST_NAME.add("叶吉"); CN_FIRST_NAME.add("惜萱"); CN_FIRST_NAME.add("柔谨"); CN_FIRST_NAME.add("凌霜"); CN_FIRST_NAME.add("学海"); CN_FIRST_NAME.add("孟乐"); CN_FIRST_NAME.add("又香"); CN_FIRST_NAME.add("绮怀"); CN_FIRST_NAME.add("绮思"); CN_FIRST_NAME.add("依童"); CN_FIRST_NAME.add("丽文"); CN_FIRST_NAME.add("今瑶"); CN_FIRST_NAME.add("三诗"); CN_FIRST_NAME.add("飞尘"); CN_FIRST_NAME.add("雅素"); CN_FIRST_NAME.add("小夏"); CN_FIRST_NAME.add("嘉珍"); CN_FIRST_NAME.add("怀绿"); CN_FIRST_NAME.add("侠骞"); CN_FIRST_NAME.add("智阳"); CN_FIRST_NAME.add("俊喆"); CN_FIRST_NAME.add("鸿畅"); CN_FIRST_NAME.add("秋彤"); CN_FIRST_NAME.add("晴雪"); CN_FIRST_NAME.add("修然"); CN_FIRST_NAME.add("佳思"); CN_FIRST_NAME.add("成弘"); CN_FIRST_NAME.add("珠雨"); CN_FIRST_NAME.add("鸿畴"); CN_FIRST_NAME.add("梅雪"); CN_FIRST_NAME.add("幻丝"); CN_FIRST_NAME.add("锐利"); CN_FIRST_NAME.add("凌青"); CN_FIRST_NAME.add("紫雪"); CN_FIRST_NAME.add("涵阳"); CN_FIRST_NAME.add("琼诗"); CN_FIRST_NAME.add("若蕊"); CN_FIRST_NAME.add("怜容"); CN_FIRST_NAME.add("水蓉"); CN_FIRST_NAME.add("泰清"); CN_FIRST_NAME.add("赞悦"); CN_FIRST_NAME.add("元柳"); CN_FIRST_NAME.add("香薇"); CN_FIRST_NAME.add("松雪"); CN_FIRST_NAME.add("水蓝"); CN_FIRST_NAME.add("艳卉"); CN_FIRST_NAME.add("晴霞"); CN_FIRST_NAME.add("兰芝"); CN_FIRST_NAME.add("松雨"); CN_FIRST_NAME.add("幼丝"); CN_FIRST_NAME.add("运锋"); CN_FIRST_NAME.add("乐荷"); CN_FIRST_NAME.add("思宸"); CN_FIRST_NAME.add("悦欣"); CN_FIRST_NAME.add("尔风"); CN_FIRST_NAME.add("星腾"); CN_FIRST_NAME.add("雪风"); CN_FIRST_NAME.add("白易"); CN_FIRST_NAME.add("语海"); CN_FIRST_NAME.add("会欣"); CN_FIRST_NAME.add("香旋"); CN_FIRST_NAME.add("筠溪"); CN_FIRST_NAME.add("兰芳"); CN_FIRST_NAME.add("盼雁"); CN_FIRST_NAME.add("阳伯"); CN_FIRST_NAME.add("天华"); CN_FIRST_NAME.add("若薇"); CN_FIRST_NAME.add("荷珠"); CN_FIRST_NAME.add("妙旋"); CN_FIRST_NAME.add("翠茵"); CN_FIRST_NAME.add("孤丹"); CN_FIRST_NAME.add("书意"); CN_FIRST_NAME.add("梅青"); CN_FIRST_NAME.add("晓筠"); CN_FIRST_NAME.add("珺琦"); CN_FIRST_NAME.add("莺语"); CN_FIRST_NAME.add("晶霞"); CN_FIRST_NAME.add("梦华"); CN_FIRST_NAME.add("晨风"); CN_FIRST_NAME.add("良吉"); CN_FIRST_NAME.add("奇迈"); CN_FIRST_NAME.add("烨华"); CN_FIRST_NAME.add("忻忻"); CN_FIRST_NAME.add("斯伯"); CN_FIRST_NAME.add("以冬"); CN_FIRST_NAME.add("北辰"); CN_FIRST_NAME.add("文君"); CN_FIRST_NAME.add("令燕"); CN_FIRST_NAME.add("秋翠"); CN_FIRST_NAME.add("芸欣"); CN_FIRST_NAME.add("正平"); CN_FIRST_NAME.add("珺琪"); CN_FIRST_NAME.add("兰若"); CN_FIRST_NAME.add("嘉瑞"); CN_FIRST_NAME.add("闵雨"); CN_FIRST_NAME.add("骏桀"); CN_FIRST_NAME.add("成龙"); CN_FIRST_NAME.add("韵磬"); CN_FIRST_NAME.add("建弼"); CN_FIRST_NAME.add("含之"); CN_FIRST_NAME.add("怡宁"); CN_FIRST_NAME.add("兰英"); CN_FIRST_NAME.add("天玉"); CN_FIRST_NAME.add("淼淼"); CN_FIRST_NAME.add("盼盼"); CN_FIRST_NAME.add("淑华"); CN_FIRST_NAME.add("竹筱"); CN_FIRST_NAME.add("谷蓝"); CN_FIRST_NAME.add("慧君"); CN_FIRST_NAME.add("翠荷"); CN_FIRST_NAME.add("佳悦"); CN_FIRST_NAME.add("茂才"); CN_FIRST_NAME.add("水蕊"); CN_FIRST_NAME.add("虹雨"); CN_FIRST_NAME.add("灵慧"); CN_FIRST_NAME.add("柔洁"); CN_FIRST_NAME.add("泽洋"); CN_FIRST_NAME.add("阳辉"); CN_FIRST_NAME.add("孤云"); CN_FIRST_NAME.add("妙春"); CN_FIRST_NAME.add("秀慧"); CN_FIRST_NAME.add("学义"); CN_FIRST_NAME.add("玉成"); CN_FIRST_NAME.add("梦玉"); CN_FIRST_NAME.add("夏雪"); CN_FIRST_NAME.add("湛芳"); CN_FIRST_NAME.add("闲静"); CN_FIRST_NAME.add("文瑞"); CN_FIRST_NAME.add("香春"); CN_FIRST_NAME.add("语丝"); CN_FIRST_NAME.add("文瑶"); CN_FIRST_NAME.add("初之"); CN_FIRST_NAME.add("佳惠"); CN_FIRST_NAME.add("华楚"); CN_FIRST_NAME.add("书慧"); CN_FIRST_NAME.add("若星"); CN_FIRST_NAME.add("坚诚"); CN_FIRST_NAME.add("含云"); CN_FIRST_NAME.add("半槐"); CN_FIRST_NAME.add("信厚"); CN_FIRST_NAME.add("冰安"); CN_FIRST_NAME.add("愉心"); CN_FIRST_NAME.add("浩思"); CN_FIRST_NAME.add("奇逸"); CN_FIRST_NAME.add("宣朗"); CN_FIRST_NAME.add("惜蕊"); CN_FIRST_NAME.add("谷蕊"); CN_FIRST_NAME.add("芮波"); CN_FIRST_NAME.add("幼仪"); CN_FIRST_NAME.add("听云"); CN_FIRST_NAME.add("妙晴"); CN_FIRST_NAME.add("可嘉"); CN_FIRST_NAME.add("力强"); CN_FIRST_NAME.add("建德"); CN_FIRST_NAME.add("长文"); CN_FIRST_NAME.add("湛英"); CN_FIRST_NAME.add("夏真"); CN_FIRST_NAME.add("敏学"); CN_FIRST_NAME.add("凝阳"); CN_FIRST_NAME.add("忆曼"); CN_FIRST_NAME.add("碧莹"); CN_FIRST_NAME.add("思山"); } }
cod3cat/JavaMasterClass
Constructors/src/com/cod3cat/constructors/VipCustomer.java
<reponame>cod3cat/JavaMasterClass package com.cod3cat.constructors; public class VipCustomer { private String name; private int creditLimit; private String customerEMail; public VipCustomer() { this("default Name", 25000, "<EMAIL>"); } public VipCustomer(String name, String customerEMail) { this(name, 25000, customerEMail); } public VipCustomer(String name, int creditLimit, String customerEMail) { this.name = name; this.creditLimit = creditLimit; this.customerEMail = customerEMail; } public String getName() { return name; } public int getCreditLimit() { return creditLimit; } public String getCustomerEMail() { return customerEMail; } }
shaddyx/LaneJS
lane/js/FormElements/ActionlPanel.js
<filename>lane/js/FormElements/ActionlPanel.js /** * * @constructor */ var ActionPanel = function() { Panel.call(this); }; Util.extend(ActionPanel, Panel); ActionPanel.type = "ActionPanel";
MattDodsonEnglish/zitadel
internal/project/model/api_config.go
package model import ( "fmt" "strings" "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/id" ) type APIConfig struct { es_models.ObjectRoot AppID string ClientID string ClientSecret *crypto.CryptoValue ClientSecretString string AuthMethodType APIAuthMethodType ClientKeys []*ClientKey } type APIAuthMethodType int32 const ( APIAuthMethodTypeBasic APIAuthMethodType = iota APIAuthMethodTypePrivateKeyJWT ) func (c *APIConfig) IsValid() bool { return true } //ClientID random_number@projectname (eg. 495894098234@zitadel) func (c *APIConfig) GenerateNewClientID(idGenerator id.Generator, project *Project) error { rndID, err := idGenerator.Next() if err != nil { return err } c.ClientID = fmt.Sprintf("%v@%v", rndID, strings.ReplaceAll(strings.ToLower(project.Name), " ", "_")) return nil } func (c *APIConfig) GenerateClientSecretIfNeeded(generator crypto.Generator) (string, error) { if c.AuthMethodType == APIAuthMethodTypeBasic { return c.GenerateNewClientSecret(generator) } return "", nil } func (c *APIConfig) GenerateNewClientSecret(generator crypto.Generator) (string, error) { cryptoValue, stringSecret, err := crypto.NewCode(generator) if err != nil { logging.Log("MODEL-ADvd2").OnError(err).Error("unable to create client secret") return "", errors.ThrowInternal(err, "MODEL-dsvr43", "Errors.Project.CouldNotGenerateClientSecret") } c.ClientSecret = cryptoValue return stringSecret, nil }
meghana-rajashekar/testing-intersight
apis/workflow/v1alpha1/zz_generated.managedlist.go
/* Copyright 2021 The Crossplane Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by angryjet. DO NOT EDIT. package v1alpha1 import resource "github.com/crossplane/crossplane-runtime/pkg/resource" // GetItems of this AnsibleBatchExecutorList. func (l *AnsibleBatchExecutorList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this BatchApiExecutorList. func (l *BatchApiExecutorList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this CustomDataTypeDefinitionList. func (l *CustomDataTypeDefinitionList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this ErrorResponseHandlerList. func (l *ErrorResponseHandlerList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this RollbackWorkflowList. func (l *RollbackWorkflowList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this SolutionActionDefinitionList. func (l *SolutionActionDefinitionList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this SolutionActionInstanceList. func (l *SolutionActionInstanceList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this SolutionDefinitionList. func (l *SolutionDefinitionList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this SolutionInstanceList. func (l *SolutionInstanceList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this SolutionOutputList. func (l *SolutionOutputList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this SshBatchExecutorList. func (l *SshBatchExecutorList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this TaskDefinitionList. func (l *TaskDefinitionList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this WorkflowDefinitionList. func (l *WorkflowDefinitionList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items } // GetItems of this WorkflowInfoList. func (l *WorkflowInfoList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] } return items }
wesleyendliche/Python_exercises
World_1/018sincostan.py
<gh_stars>0 from math import radians, sin, cos, tan an = float(input('Digite o ângulo que você deseja: ')) seno = sin(radians(an)) print('O ângulo de {} tem o SENO de {:.2f}'.format(an, seno)) cosseno = cos(radians(an)) print('O ângulo de {} tem o COSSENO de {:.2f}'.format(an, cosseno)) tangente = tan(radians(an)) print('O ângulo de {} tem a TANGENTE de {:.2f}'.format(an, tangente))
iamjli/pyranges
tests/test_pickle.py
<filename>tests/test_pickle.py import pyranges as pr import pickle def test_pickle(): gr = pr.data.f1() pickle.dump(gr, open("hi", "wb+")) gr2 = pickle.load(open("hi", "rb"))
homich1991/ignite
modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceReassignmentTest.java
<gh_stars>1-10 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.internal.processors.service; import java.util.concurrent.ThreadLocalRandom; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteException; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.PA; import org.apache.ignite.resources.IgniteInstanceResource; import org.apache.ignite.services.Service; import org.apache.ignite.services.ServiceConfiguration; import org.apache.ignite.services.ServiceContext; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; /** * */ public class IgniteServiceReassignmentTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); /** */ private ServiceConfiguration srvcCfg; /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER); if (srvcCfg != null) cfg.setServiceConfiguration(srvcCfg); return cfg; } /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { stopAllGrids(); super.afterTest(); } /** * @throws Exception If failed. */ public void testNodeRestart1() throws Exception { srvcCfg = serviceConfiguration(); Ignite node1 = startGrid(1); assertEquals(42, serviceProxy(node1).foo()); srvcCfg = serviceConfiguration(); Ignite node2 = startGrid(2); node1.close(); waitForService(node2); assertEquals(42, serviceProxy(node2).foo()); srvcCfg = serviceConfiguration(); Ignite node3 = startGrid(3); assertEquals(42, serviceProxy(node3).foo()); srvcCfg = serviceConfiguration(); node1 = startGrid(1); assertEquals(42, serviceProxy(node1).foo()); assertEquals(42, serviceProxy(node2).foo()); assertEquals(42, serviceProxy(node3).foo()); node2.close(); waitForService(node1); assertEquals(42, serviceProxy(node1).foo()); assertEquals(42, serviceProxy(node3).foo()); } /** * @throws Exception If failed. */ public void testNodeRestart2() throws Exception { startGrids(3); ServiceConfiguration svcCfg = new ServiceConfiguration(); svcCfg.setName("DummyService"); svcCfg.setTotalCount(10); svcCfg.setMaxPerNodeCount(1); svcCfg.setService(new DummyService()); ignite(0).services().deploy(svcCfg); for (int i = 0; i < 3; i++) assertEquals(42, serviceProxy(ignite(i)).foo()); for (int i = 0; i < 3; i++) startGrid(i + 3); for (int i = 0; i < 3; i++) stopGrid(i); for (int i = 0; i < 3; i++) assertEquals(42, serviceProxy(ignite(i + 3)).foo()); } /** * @throws Exception If failed. */ public void testNodeRestartRandom() throws Exception { final int NODES = 5; Ignite ignite = startGridsMultiThreaded(NODES); ignite.services().deploy(serviceConfiguration()); for (int i = 0; i < 30; i++) { log.info("Iteration: " + i); int stopIdx = ThreadLocalRandom.current().nextInt(NODES); stopGrid(stopIdx); for (int nodeIdx = 0; nodeIdx < NODES; nodeIdx++) { if (nodeIdx == stopIdx) continue; waitForService(ignite(nodeIdx)); assertEquals(42, serviceProxy(ignite(nodeIdx)).foo()); } startGrid(stopIdx); for (int nodeIdx = 0; nodeIdx < NODES; nodeIdx++) assertEquals(42, serviceProxy(ignite(nodeIdx)).foo()); } } /** * @param node Node. * @throws Exception If failed. */ private void waitForService(final Ignite node) throws Exception { assertTrue(GridTestUtils.waitForCondition(new PA() { @Override public boolean apply() { try { serviceProxy(node).foo(); return true; } catch (IgniteException ignored) { return false; } } }, 5000)); } /** * @param node Node. * @return Service proxy. */ private static MyService serviceProxy(Ignite node) { return node.services().serviceProxy("DummyService", MyService.class, true); } /** * @return Service configuration. */ private ServiceConfiguration serviceConfiguration() { ServiceConfiguration svc = new ServiceConfiguration(); svc.setName("DummyService"); svc.setTotalCount(1); svc.setService(new DummyService()); return svc; } /** * */ public interface MyService { /** * @return Dummy result. */ int foo(); } /** * */ static class DummyService implements MyService, Service { /** */ @IgniteInstanceResource private Ignite locNode; /** {@inheritDoc} */ @Override public void cancel(ServiceContext ctx) { locNode.log().info("Service cancelled [execId=" + ctx.executionId() + ", node=" + locNode.cluster().localNode() + ']'); } /** {@inheritDoc} */ @Override public void init(ServiceContext ctx) { locNode.log().info("Service initialized [execId=" + ctx.executionId() + ", node=" + locNode.cluster().localNode() + ']'); } /** {@inheritDoc} */ @Override public void execute(ServiceContext ctx) { locNode.log().info("Service started [execId=" + ctx.executionId() + ", node=" + locNode.cluster().localNode() + ']'); } /** {@inheritDoc} */ @Override public int foo() { locNode.log().info("Service called."); return 42; } } }