org.apache.commons.compress.utils.Lists Java Examples

The following examples show how to use org.apache.commons.compress.utils.Lists. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChainFinderCompare.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
private final List<CfBreakendData> loadChainFinderData(final String sampleId, final String chainDataFile)
{
    try
    {
        final List<String> lines = Files.readAllLines(Paths.get(chainDataFile));

        if(lines.size() <= 2)
            return Lists.newArrayList();

        final Map<String,Integer> fielIndexMap = createFieldsIndexMap(lines.get(0), CF_DATA_DELIMITER);
        lines.remove(0); // header
        lines.remove(lines.size() - 1); // summary row

        return lines.stream().map(x -> CfBreakendData.fromData(x, fielIndexMap)).collect(Collectors.toList());
    }
    catch(IOException e)
    {
        LNX_LOGGER.error("failed to load chain data file({}): {}", chainDataFile.toString(), e.toString());
        return null;
    }

}
 
Example #2
Source File: AliyunMsgMaker.java    From WePush with MIT License 6 votes vote down vote up
/**
 * 准备(界面字段等)
 */
@Override
public void prepare() {
    templateId = AliYunMsgForm.getInstance().getMsgTemplateIdTextField().getText();

    if (AliYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        AliYunMsgForm.initTemplateDataTable();
    }

    DefaultTableModel tableModel = (DefaultTableModel) AliYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
    int rowCount = tableModel.getRowCount();
    TemplateData templateData;
    templateDataList = Lists.newArrayList();
    for (int i = 0; i < rowCount; i++) {
        String name = ((String) tableModel.getValueAt(i, 0)).trim();
        String value = ((String) tableModel.getValueAt(i, 1)).trim();
        templateData = new TemplateData();
        templateData.setName(name);
        templateData.setValue(value);
        templateDataList.add(templateData);
    }

}
 
Example #3
Source File: WxMaSubscribeMsgMaker.java    From WePush with MIT License 6 votes vote down vote up
/**
 * 准备(界面字段等)
 */
@Override
public void prepare() {
    templateId = MaSubscribeMsgForm.getInstance().getMsgTemplateIdTextField().getText().trim();
    templateUrl = MaSubscribeMsgForm.getInstance().getMsgTemplateUrlTextField().getText().trim();

    if (MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        MaSubscribeMsgForm.initTemplateDataTable();
    }

    DefaultTableModel tableModel = (DefaultTableModel) MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable().getModel();
    int rowCount = tableModel.getRowCount();
    TemplateData templateData;
    templateDataList = Lists.newArrayList();
    for (int i = 0; i < rowCount; i++) {
        String name = ((String) tableModel.getValueAt(i, 0)).trim();
        String value = ((String) tableModel.getValueAt(i, 1)).trim();
        String color = ((String) tableModel.getValueAt(i, 2)).trim();
        templateData = new TemplateData();
        templateData.setName(name);
        templateData.setValue(value);
        templateData.setColor(color);
        templateDataList.add(templateData);
    }
}
 
Example #4
Source File: UpYunMsgMaker.java    From WePush with MIT License 6 votes vote down vote up
/**
 * 准备(界面字段等)
 */
@Override
public void prepare() {
    templateId = UpYunMsgForm.getInstance().getMsgTemplateIdTextField().getText();

    if (UpYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        UpYunMsgForm.initTemplateDataTable();
    }

    DefaultTableModel tableModel = (DefaultTableModel) UpYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
    int rowCount = tableModel.getRowCount();
    paramList = Lists.newArrayList();
    for (int i = 0; i < rowCount; i++) {
        String value = ((String) tableModel.getValueAt(i, 1));
        paramList.add(value);
    }
}
 
Example #5
Source File: TxYunMsgMaker.java    From WePush with MIT License 6 votes vote down vote up
/**
 * 准备(界面字段等)
 */
@Override
public void prepare() {
    templateId = Integer.parseInt(TxYunMsgForm.getInstance().getMsgTemplateIdTextField().getText());

    if (TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        TxYunMsgForm.initTemplateDataTable();
    }

    DefaultTableModel tableModel = (DefaultTableModel) TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
    int rowCount = tableModel.getRowCount();
    paramList = Lists.newArrayList();
    for (int i = 0; i < rowCount; i++) {
        String value = ((String) tableModel.getValueAt(i, 1));
        paramList.add(value);
    }
}
 
Example #6
Source File: HwYunMsgMaker.java    From WePush with MIT License 6 votes vote down vote up
/**
 * 准备(界面字段等)
 */
@Override
public void prepare() {
    templateId = HwYunMsgForm.getInstance().getMsgTemplateIdTextField().getText();

    if (HwYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        HwYunMsgForm.initTemplateDataTable();
    }

    DefaultTableModel tableModel = (DefaultTableModel) HwYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
    int rowCount = tableModel.getRowCount();
    paramList = Lists.newArrayList();
    for (int i = 0; i < rowCount; i++) {
        String value = ((String) tableModel.getValueAt(i, 1));
        paramList.add(value);
    }
}
 
Example #7
Source File: FusionCohortData.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
public FusionCohortData(final String[] chromosomes, final int[] junctionPositions, final byte[] junctionOrientations,
        final FusionJunctionType[] junctionTypes, final String svType, final String[] geneIds, final String[] geneNames)
{
    mSampleIds = Lists.newArrayList();
    Chromosomes = chromosomes;
    JunctionPositions = junctionPositions;
    JunctionOrientations = junctionOrientations;
    JunctionTypes = junctionTypes;
    SvType = svType;
    GeneIds = geneIds;
    GeneNames = geneNames;

    mSampleCount = 0;
    mTotalFragments = 0;
    mMaxFragments = 0;
}
 
Example #8
Source File: WxMaTemplateMsgMaker.java    From WePush with MIT License 6 votes vote down vote up
/**
 * 准备(界面字段等)
 */
@Override
public void prepare() {
    templateId = MaTemplateMsgForm.getInstance().getMsgTemplateIdTextField().getText().trim();
    templateUrl = MaTemplateMsgForm.getInstance().getMsgTemplateUrlTextField().getText().trim();
    templateKeyWord = MaTemplateMsgForm.getInstance().getMsgTemplateKeyWordTextField().getText().trim() + ".DATA";

    if (MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        MaTemplateMsgForm.initTemplateDataTable();
    }

    DefaultTableModel tableModel = (DefaultTableModel) MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel();
    int rowCount = tableModel.getRowCount();
    TemplateData templateData;
    templateDataList = Lists.newArrayList();
    for (int i = 0; i < rowCount; i++) {
        String name = ((String) tableModel.getValueAt(i, 0)).trim();
        String value = ((String) tableModel.getValueAt(i, 1)).trim();
        String color = ((String) tableModel.getValueAt(i, 2)).trim();
        templateData = new TemplateData();
        templateData.setName(name);
        templateData.setValue(value);
        templateData.setColor(color);
        templateDataList.add(templateData);
    }
}
 
Example #9
Source File: MainFrame.java    From WePush with MIT License 6 votes vote down vote up
public void init() {
    this.setName(UiConsts.APP_NAME);
    this.setTitle(UiConsts.APP_NAME);
    List<Image> images = Lists.newArrayList();
    images.add(UiConsts.IMAGE_LOGO_1024);
    images.add(UiConsts.IMAGE_LOGO_512);
    images.add(UiConsts.IMAGE_LOGO_256);
    images.add(UiConsts.IMAGE_LOGO_128);
    images.add(UiConsts.IMAGE_LOGO_64);
    images.add(UiConsts.IMAGE_LOGO_48);
    images.add(UiConsts.IMAGE_LOGO_32);
    images.add(UiConsts.IMAGE_LOGO_24);
    images.add(UiConsts.IMAGE_LOGO_16);
    this.setIconImages(images);
    // Mac系统Dock图标
    if (SystemUtil.isMacOs()) {
        Application application = Application.getApplication();
        application.setDockIconImage(UiConsts.IMAGE_LOGO_1024);
        application.setEnabledAboutMenu(false);
        application.setEnabledPreferencesMenu(false);
    }

    ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.8, 0.88);
}
 
Example #10
Source File: BufferedPostProcessor.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
protected void flush(@NotNull final GenomePosition position) {
    final List<SageVariant> flushed = Lists.newArrayList();
    final Iterator<SageVariant> iterator = buffer.iterator();
    while (iterator.hasNext()) {
        final SageVariant entry = iterator.next();
        long entryEnd = entry.position() + entry.ref().length() - 1;
        if (!entry.chromosome().equals(position.chromosome()) || entryEnd < position.position() - maxDistance) {
            iterator.remove();
            flushed.add(entry);
        } else {
            break;
        }
    }

    if (!flushed.isEmpty()) {
        preFlush(flushed);
    }

    flushed.forEach(consumer);
    flushed.clear();
}
 
Example #11
Source File: FusionData.java    From hmftools with GNU General Public License v3.0 6 votes vote down vote up
public FusionData(int id, final String[] chromosomes, final int[] junctionPositions, final byte[] junctionOrientations,
        final FusionJunctionType[] junctionTypes, final String svType, final String[] geneIds, final String[] geneNames,
        int splitFrags, int realignedFrags, int discordantFrags, final int[] coverage, final int[] anchorDistance, int cohortCount)
{
    Id = id;
    Chromosomes = chromosomes;
    JunctionPositions = junctionPositions;
    JunctionOrientations = junctionOrientations;
    JunctionTypes = junctionTypes;
    SvType = svType;
    GeneIds = geneIds;
    GeneNames = geneNames;
    SplitFrags = splitFrags;
    RealignedFrags = realignedFrags;
    DiscordantFrags = discordantFrags;
    Coverage = coverage;
    AnchorDistance = anchorDistance;
    CohortCount = cohortCount;

    mRawData = null;
    mKnownFusionType = KnownGeneType.OTHER;
    mRelatedFusionIds = Lists.newArrayList();
    mHasRelatedKnownSpliceSites = false;
    mCohortFrequency = 0;
    mFilter = "";
}
 
Example #12
Source File: Fx3DVisualizerModule.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
public static void setupNew3DVisualizer(final RawDataFile dataFile, final Range<Double> mzRange,
    final Range<Double> rtRange, final Feature featureToShow) {

  final ParameterSet myParameters =
      MZmineCore.getConfiguration().getModuleParameters(Fx3DVisualizerModule.class);
  final Fx3DVisualizerModule myInstance =
      MZmineCore.getModuleInstance(Fx3DVisualizerModule.class);
  myParameters.getParameter(Fx3DVisualizerParameters.dataFiles)
      .setValue(RawDataFilesSelectionType.SPECIFIC_FILES, new RawDataFile[] {dataFile});
  myParameters.getParameter(Fx3DVisualizerParameters.scanSelection)
      .setValue(new ScanSelection(rtRange, 1));
  myParameters.getParameter(Fx3DVisualizerParameters.mzRange).setValue(mzRange);
  
  List<FeatureSelection> featuresList = Lists.newArrayList();
  if (featureToShow != null) {
    FeatureSelection selectedFeature = new FeatureSelection(null, featureToShow, null, null);
    featuresList.add(selectedFeature);
  }
  
  myParameters.getParameter(Fx3DVisualizerParameters.features).setValue(featuresList);
  if (myParameters.showSetupDialog(MZmineCore.getDesktop().getMainWindow(),
      true) == ExitCode.OK) {
    myInstance.runModule(MZmineCore.getProjectManager().getCurrentProject(),
        myParameters.cloneParameterSet(), new ArrayList<Task>());
  }
}
 
Example #13
Source File: LivyRestExecutor.java    From kylin with Apache License 2.0 6 votes vote down vote up
private List<String> getLogs(JSONObject logInfo) {
    List<String> logs = Lists.newArrayList();
    if (logInfo.has("log")) {
        try {
            JSONArray logArray = logInfo.getJSONArray("log");

            for (int i=0; i<logArray.length(); i++) {
                logs.add(logArray.getString(i));
            }

        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    return logs;
}
 
Example #14
Source File: OLAPWindowRel.java    From kylin with Apache License 2.0 6 votes vote down vote up
ColumnRowType buildColumnRowType() {
    OLAPRel olapChild = (OLAPRel) getInput(0);
    ColumnRowType inputColumnRowType = olapChild.getColumnRowType();

    List<TblColRef> columns = new ArrayList<>();
    // the input col always be collected by left
    columns.addAll(inputColumnRowType.getAllColumns());

    // add window aggregate calls column
    for (Group group : groups) {
        List<TupleExpression> sourceColOuter = Lists.newArrayList();
        group.keys.asSet().stream().map(inputColumnRowType::getTupleExpressionByIndex).forEach(sourceColOuter::add);
        group.orderKeys.getFieldCollations().stream().map(RelFieldCollation::getFieldIndex)
                .map(inputColumnRowType::getTupleExpressionByIndex).forEach(sourceColOuter::add);
        for (AggregateCall aggrCall : group.getAggregateCalls(this)) {
            TblColRef aggrCallCol = TblColRef.newInnerColumn(aggrCall.getName(),
                    TblColRef.InnerDataTypeEnum.LITERAL);
            List<TupleExpression> sourceColInner = Lists.newArrayList(sourceColOuter.iterator());
            aggrCall.getArgList().stream().filter(i -> i < inputColumnRowType.size())
                    .map(inputColumnRowType::getTupleExpressionByIndex).forEach(sourceColInner::add);
            aggrCallCol.setSubTupleExps(sourceColInner);
            columns.add(aggrCallCol);
        }
    }
    return new ColumnRowType(columns);
}
 
Example #15
Source File: JdbcUtilsTests.java    From platform with Apache License 2.0 6 votes vote down vote up
@Test
public void createTemporaryTableTest() throws SQLException {
    String temporaryTableName = null;
    Connection connection = null;
    try {
        List<Long> idList = Lists.newArrayList();
        for (int i = 0; i < 1000000; i++) {
            idList.add(idWorker.nextId());
        }
        connection = this.dataSource.getConnection();
        long startTime = System.currentTimeMillis();
        temporaryTableName = JdbcUtils.createTemporaryTable(connection, idList);
        long endTime = System.currentTimeMillis();
        System.out.println(endTime - startTime);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (StringUtils.isNotEmpty(temporaryTableName)) {
            JdbcUtils.dropTemporaryTable(connection, temporaryTableName);
        }
        JdbcUtils.close(connection);
    }
}
 
Example #16
Source File: SysDicController.java    From hdw-dubbo with Apache License 2.0 6 votes vote down vote up
/**
 * 数据字典选择
 *
 * @return
 */
@ApiOperation(value = "数据字典选择", notes = "数据字典选择")
@ApiImplicitParam(paramType = "path", name = "parentId", value = "父ID", required = true, dataType = "Integer")
@GetMapping("/select/{parentId}")
public CommonResult<List<SelectTreeNode>> select(@PathVariable("parentId") Long parentId) {
    Map<String, Object> params = Maps.newHashMap();
    if (parentId != null && 0 != parentId) {
        params.put("parentId", parentId);
    }
    List<SysDic> dicList = sysDicService.selectDicList(params);
    List<SelectTreeNode> treeNodeList = Lists.newArrayList();
    if (!dicList.isEmpty()) {
        dicList.forEach(dic -> {
            SelectTreeNode selectTreeNode = new SelectTreeNode();
            selectTreeNode.setId(dic.getId().toString());
            selectTreeNode.setParentId(dic.getParentId().toString());
            selectTreeNode.setName(dic.getVarName());
            treeNodeList.add(selectTreeNode);
        });
    }
    treeNodeList.add(SelectTreeNode.createParent());
    return CommonResult.success(treeNodeList);
}
 
Example #17
Source File: SysRoleController.java    From hdw-dubbo with Apache License 2.0 6 votes vote down vote up
/**
 * 角色信息
 */
@ApiOperation(value = "角色信息", notes = "角色信息")
@ApiImplicitParam(paramType = "path", name = "roleId", value = "主键ID", dataType = "Integer", required = true)
@GetMapping("/info/{roleId}")
@RequiresPermissions("sys/role/info")
public CommonResult<SysRole> info(@PathVariable("roleId") Long roleId) {
    SysRole role = sysRoleService.getById(roleId);
    //查询角色对应的菜单
    List<Long> resourceIdList = sysRoleResourceService.selectResourceIdListByRoleId(roleId);
    role.setResourceIdList(resourceIdList);
    List<SysRoleResource> roleResourceList = sysRoleResourceService.selectResourceNodeListByRoleId(roleId);
    List<TreeNode> treeNodeList = Lists.newArrayList();
    if (!roleResourceList.isEmpty()) {
        roleResourceList.forEach(roleResource -> {
            TreeNode treeNode = new TreeNode();
            treeNode.setId(roleResource.getResourceId().toString());
            treeNode.setLabel(roleResource.getResource().getName());
            treeNodeList.add(treeNode);
        });
    }
    role.setResourceNodeList(treeNodeList);
    return CommonResult.success(role);
}
 
Example #18
Source File: DataTest.java    From konduit-serving with Apache License 2.0 6 votes vote down vote up
@Test
public void testDoubleLists() {
    final long LIST_SIZE = 6;

    List<Double> data = Lists.newArrayList();
    for (int i = 0; i < LIST_SIZE; ++i) {
        data.add(Double.valueOf(i));
    }

    Data listOfDouble = new JData.DataBuilder().addListDouble(KEY, data).build();
    assertEquals(ValueType.DOUBLE, listOfDouble.listType(KEY));

    List<?> actual = listOfDouble.getList(KEY, ValueType.DOUBLE);
    for (int i = 0 ; i < LIST_SIZE; ++i) {
        assertEquals(data.get(i), actual.get(i));
    }
}
 
Example #19
Source File: DataTest.java    From konduit-serving with Apache License 2.0 6 votes vote down vote up
@Test
public void testBooleanList() {
    final long LIST_SIZE = 6;

    List<Boolean> data = Lists.newArrayList();
    for (int i = 0; i < LIST_SIZE; ++i) {
        data.add(i % 2 == 0);
    }
    Data listOfBoolean = Data.singletonList(KEY, data, ValueType.BOOLEAN);
    assertEquals(ValueType.BOOLEAN, listOfBoolean.listType(KEY));

    List<?> actual = listOfBoolean.getList(KEY, ValueType.BOOLEAN);
    for (int i = 0 ; i < LIST_SIZE; ++i) {
        assertEquals(data.get(i), actual.get(i));
    }
}
 
Example #20
Source File: DataTest.java    From konduit-serving with Apache License 2.0 6 votes vote down vote up
@Test
public void testsNumericLists() {
    final long LIST_SIZE = 6;

    List<Long> numbers = Lists.newArrayList();
    for (long i = 0; i < LIST_SIZE; ++i) {
        numbers.add(i);
    }
    Data listOfNumbers = new JData.DataBuilder().
            addListInt64(KEY, numbers).
            build();
    assertEquals(ValueType.INT64, listOfNumbers.listType(KEY));

    List<?> actual = listOfNumbers.getList(KEY, ValueType.INT64);
    assertEquals(numbers, actual);
    for (int i = 0 ; i < LIST_SIZE; ++i) {
        assertEquals(numbers.get(i), actual.get(i));
    }
}
 
Example #21
Source File: OLAPWindowRel.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
ColumnRowType buildColumnRowType() {
    OLAPRel olapChild = (OLAPRel) getInput(0);
    ColumnRowType inputColumnRowType = olapChild.getColumnRowType();

    List<TblColRef> columns = new ArrayList<>();
    // the input col always be collected by left
    columns.addAll(inputColumnRowType.getAllColumns());

    // add window aggregate calls column
    for (Group group : groups) {
        List<TupleExpression> sourceColOuter = Lists.newArrayList();
        group.keys.asSet().stream().map(inputColumnRowType::getTupleExpressionByIndex).forEach(sourceColOuter::add);
        group.orderKeys.getFieldCollations().stream().map(RelFieldCollation::getFieldIndex)
                .map(inputColumnRowType::getTupleExpressionByIndex).forEach(sourceColOuter::add);
        for (AggregateCall aggrCall : group.getAggregateCalls(this)) {
            TblColRef aggrCallCol = TblColRef.newInnerColumn(aggrCall.getName(),
                    TblColRef.InnerDataTypeEnum.LITERAL);
            List<TupleExpression> sourceColInner = Lists.newArrayList(sourceColOuter.iterator());
            aggrCall.getArgList().stream().filter(i -> i < inputColumnRowType.size())
                    .map(inputColumnRowType::getTupleExpressionByIndex).forEach(sourceColInner::add);
            aggrCallCol.setSubTupleExps(sourceColInner);
            columns.add(aggrCallCol);
        }
    }
    return new ColumnRowType(columns);
}
 
Example #22
Source File: LivyRestExecutor.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private List<String> getLogs(JSONObject logInfo) {
    List<String> logs = Lists.newArrayList();
    if (logInfo.has("log")) {
        try {
            JSONArray logArray = logInfo.getJSONArray("log");

            for (int i=0; i<logArray.length(); i++) {
                logs.add(logArray.getString(i));
            }

        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    return logs;
}
 
Example #23
Source File: CfSampleData.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
public CfSampleData(final String sampleId)
{
    SampleId = sampleId;
    Chains = Maps.newHashMap();
    CfSvList = Lists.newArrayList();
    UnchainedSvList = Lists.newArrayList();
    ClusterChainOverlaps = Lists.newArrayList();
    SvProximityDistance = Maps.newHashMap();
}
 
Example #24
Source File: FusionWriter.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
private static List<TransExonRef> parseTransExonRefs(final String data)
{
    List<TransExonRef> transExonRefs = Lists.newArrayList();

    for(String ref : data.split(ITEM_DELIM, -1))
    {
        String[] items = ref.split(":");
        if(items.length != 4)
            continue;

        transExonRefs.add(new TransExonRef(items[0], Integer.parseInt(items[1]), items[2], Integer.parseInt(items[3])));
    }

    return transExonRefs;
}
 
Example #25
Source File: CfBreakendData.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
public static CfBreakendData fromData(final String data, final Map<String,Integer> fieldIndexMap)
{
    // Sample	 Chain	 Breakpoint	 Rearrangement	 Chromosome:position	 Strand
    // Potential chromosomal end loss (left)	 Potential chromosomal end loss (right)	 Deletion bridge partner breakpoint
    // Adjacent breakpoint(s)	 Site annotation
    //CPCT02010452T	 3	 196	 360203	 14:49979403	 1	 0	 0	 195	 |195|197|	 na
    //CPCT02010452T	 3	 197	 360204	 14:49983004	 0	 0	 0	 198	 |196|198|	 na

    String[] items = data.split(CF_DATA_DELIMITER);

    final int chainId = Integer.parseInt(items[fieldIndexMap.get("Chain")]);
    final int breakpointId = Integer.parseInt(items[fieldIndexMap.get("Breakpoint")]);
    final int rearrangeId = Integer.parseInt(items[fieldIndexMap.get("Rearrangement")]);

    final String breakendData = items[fieldIndexMap.get("Chromosome:position")];
    final String chromosome = breakendData.split(":")[0];
    final int position = Integer.parseInt(breakendData.split(":")[1]);

    final byte orientation = items[fieldIndexMap.get("Strand")].equals("0") ? POS_STRAND : NEG_STRAND;

    final boolean[] chromosomeEndLoss = new boolean[] {
            items[fieldIndexMap.get("Potential chromosomal end loss (left)")].equals("1"),
            items[fieldIndexMap.get("Potential chromosomal end loss (right)")].equals("1") };

    final int dbBreakendId = items.length == fieldIndexMap.size() ?
            Integer.parseInt(items[fieldIndexMap.get("Deletion bridge partner breakpoint")]) : NO_ID;

    int adjBndIndex = fieldIndexMap.get("Adjacent breakpoint(s)");
    final String adjacentBreakendData = items.length == fieldIndexMap.size() ? items[adjBndIndex] : items[adjBndIndex - 1];
    int abLength = adjacentBreakendData.length();

    final List<Integer> adjacentBreakendIds = abLength > 2 ?
            Arrays.stream(adjacentBreakendData.substring(0, abLength - 1).substring(1).split("\\|"))
                    .map(x -> Integer.parseInt(x)).collect(Collectors.toList()) : Lists.newArrayList();

    return new CfBreakendData(chainId, breakpointId, rearrangeId, chromosome, position, orientation, chromosomeEndLoss, dbBreakendId, adjacentBreakendIds);
}
 
Example #26
Source File: DeleteCommand.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * Example command line: {@code tf delete dir/file.txt}
 * <p>
 * Example stdout:<br>
 * <pre>{@code dir:
 * file.txt}</pre>
 * <p>
 * Example stderr:<br>
 * <pre>{@code The item C:\FullPath\dir\file.txt could not be found in your workspace, or you do not have permission to access it.}</pre>
 */
public TfvcDeleteResult parseOutput(String stdout, String stderr) {
    List<java.nio.file.Path> deletedPaths = Lists.newArrayList();
    List<TfsPath> notFoundFiles = Lists.newArrayList();
    List<String> errorMessages = Lists.newArrayList();

    parseStdErr(stderr, notFoundFiles, errorMessages);
    parseStdOut(stdout, deletedPaths);

    return new TfvcDeleteResult(deletedPaths, notFoundFiles, errorMessages);
}
 
Example #27
Source File: CheckoutCommand.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * Example command line: {@code tf delete dir/file.txt}
 * <p>
 * Example stdout:<br>
 * <pre>{@code dir:
 * file.txt}</pre>
 * <p>
 * Example stderr:<br>
 * <pre>{@code The item C:\FullPath\dir\file.txt could not be found in your workspace, or you do not have permission to access it.}</pre>
 */
@Override
public TfvcCheckoutResult parseOutput(String stdout, String stderr) {
    List<TfsLocalPath> checkedOutFiles = Lists.newArrayList();
    List<TfsLocalPath> notFoundFiles = Lists.newArrayList();
    List<String> errorMessages = Lists.newArrayList();

    parseStdErr(stderr, notFoundFiles, errorMessages);
    parseStdOut(stdout, checkedOutFiles);

    return new TfvcCheckoutResult(checkedOutFiles, notFoundFiles, errorMessages);
}
 
Example #28
Source File: TypeDescription.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public Collection<String> getOrderedAttributeNames(final Set<String> facetsToConsider) {
	// AD Revised in Aug 2019 for Issue #2869: keep constraints between superspecies and subspecies
	final DirectedGraph<String, Object> dependencies = new DefaultDirectedGraph<>(Object.class);
	final Map<String, VariableDescription> all = new HashMap<>();
	this.visitAllAttributes((d) -> {
		all.put(d.getName(), (VariableDescription) d);
		return true;
	});
	Graphs.addAllVertices(dependencies, all.keySet());
	final VariableDescription shape = getAttribute(SHAPE);
	final Collection<VariableDescription> shapeDependencies =
			shape == null ? Collections.EMPTY_LIST : shape.getDependencies(facetsToConsider, false, true);
	all.forEach((an, var) -> {
		for (final VariableDescription newVar : var.getDependencies(facetsToConsider, false, true)) {
			final String other = newVar.getName();
			// AD Revision in April 2019 for Issue #2624: prevent cycles when building the graph
			if (!dependencies.containsEdge(an, other)) {
				dependencies.addEdge(other, an);
			}
		}
		// Adding a constraint between the shape of the macrospecies and the populations of microspecies
		if (var.isSyntheticSpeciesContainer() && !shapeDependencies.contains(var)) {
			dependencies.addEdge(SHAPE, an);
		}
	});
	// June 2020: moving (back) to Iterables instead of Streams.
	return Lists.newArrayList(new TopologicalOrderIterator<>(dependencies));
	// return StreamEx.of(new TopologicalOrderIterator<>(dependencies)).toList();
}
 
Example #29
Source File: SecurityUserDetailsService.java    From platform with Apache License 2.0 5 votes vote down vote up
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    UserDto user = userService.findByUsername(username);
    if (null == user) {
        throw new UsernameNotFoundException(username);
    }

    List<SimpleGrantedAuthority> authorities = Lists.newArrayList();
    authorities.add(new SimpleGrantedAuthority("USER"));

    return new SecurityUser(user.getUsername(), user.getPassword(), authorities);
}
 
Example #30
Source File: P2BrowseNodeGenerator.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public List<BrowsePaths> computeAssetPaths(final Asset asset, @Nullable final Component component) {
  String remote = component == null ? getRemoteForMetadataAsset(asset.name()) : getRemoteForPackage(asset.name());
  List<BrowsePaths> paths = Lists.newArrayList(computeComponentPaths(asset, component).iterator());
  paths.addAll(BrowsePaths
      .fromPaths(Lists.newArrayList(
          Splitter.on(DIVIDER).omitEmptyStrings().split(getRelativePath(asset.name(), remote)).iterator()),
          true));
  return paths;
}